From b8524aa5a82a8b0dad25138acbe7042b8094b663 Mon Sep 17 00:00:00 2001 From: XShine555 Date: Thu, 24 Sep 2026 13:31:31 +0200 Subject: [PATCH] Update naming conventions in .editorconfig and docs.editorc --- backend/.editorconfig | 39 ++++++++++++++++++++++++--------------- backend/CLAUDE.md | 2 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/backend/.editorconfig b/backend/.editorconfig index e78ac4b..128436e 100644 --- a/backend/.editorconfig +++ b/backend/.editorconfig @@ -33,28 +33,37 @@ csharp_style_prefer_primary_constructors = true:suggestion csharp_style_expression_bodied_methods = when_on_single_line:suggestion dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion +# Naming. Roslyn applies the first matching rule in file order, so the specific rules come first. +# Private fields are _camelCase whatever their modifiers (static, readonly, const). dotnet_naming_rule.private_fields.symbols = private_fields -dotnet_naming_rule.private_fields.style = camel_case +dotnet_naming_rule.private_fields.style = underscore_camel_case dotnet_naming_rule.private_fields.severity = warning dotnet_naming_symbols.private_fields.applicable_kinds = field dotnet_naming_symbols.private_fields.applicable_accessibilities = private -dotnet_naming_symbols.private_fields.required_modifiers = -dotnet_naming_style.camel_case.capitalization = camel_case +dotnet_naming_style.underscore_camel_case.capitalization = camel_case +dotnet_naming_style.underscore_camel_case.required_prefix = _ -dotnet_naming_rule.private_static_readonly.symbols = private_static_readonly -dotnet_naming_rule.private_static_readonly.style = pascal_case -dotnet_naming_rule.private_static_readonly.severity = warning -dotnet_naming_symbols.private_static_readonly.applicable_kinds = field -dotnet_naming_symbols.private_static_readonly.applicable_accessibilities = private -dotnet_naming_symbols.private_static_readonly.required_modifiers = static, readonly - -dotnet_naming_rule.private_constants.symbols = private_constants -dotnet_naming_rule.private_constants.style = pascal_case -dotnet_naming_rule.private_constants.severity = warning -dotnet_naming_symbols.private_constants.applicable_kinds = field -dotnet_naming_symbols.private_constants.required_modifiers = const +# Non-private fields (constants, static readonly, etc.) are PascalCase. +dotnet_naming_rule.other_fields.symbols = other_fields +dotnet_naming_rule.other_fields.style = pascal_case +dotnet_naming_rule.other_fields.severity = warning +dotnet_naming_symbols.other_fields.applicable_kinds = field +dotnet_naming_symbols.other_fields.applicable_accessibilities = public, internal, protected, protected_internal, private_protected dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_rule.interfaces.symbols = interfaces +dotnet_naming_rule.interfaces.style = interface_style +dotnet_naming_rule.interfaces.severity = warning +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_style.interface_style.capitalization = pascal_case +dotnet_naming_style.interface_style.required_prefix = I + +dotnet_naming_rule.types_and_members.symbols = types_and_members +dotnet_naming_rule.types_and_members.style = pascal_case +dotnet_naming_rule.types_and_members.severity = warning +dotnet_naming_symbols.types_and_members.applicable_kinds = class, struct, enum, delegate, property, method, event +dotnet_naming_symbols.types_and_members.applicable_accessibilities = * + # CA1848/CA1873 would turn every log call into a [LoggerMessage] source-generated method; CA1716 flags the # EF-style IDatabase.Set() and the Musify.Application.Shared namespace, whose names are deliberate. dotnet_diagnostic.CA1848.severity = suggestion diff --git a/backend/CLAUDE.md b/backend/CLAUDE.md index 5a29132..4a07a5a 100644 --- a/backend/CLAUDE.md +++ b/backend/CLAUDE.md @@ -20,7 +20,7 @@ dotnet format Musify.slnx --verify-no-changes ## Style - Block-scoped namespaces (`namespace X { }`; file-scoped `namespace X;` is not allowed), usings outside the namespace and sorted (`.editorconfig` enforces it). -- Private fields camelCase without underscore, constants and `static readonly` fields PascalCase, explicit accessibility. +- Private fields are `_camelCase` whatever their modifiers (including `static readonly` and `const`); non-private constants and static fields, types, methods and properties are PascalCase; interfaces start with `I`; explicit accessibility. Enforced by `.editorconfig` (IDE1006). - `ArgumentNullException.ThrowIfNull(x)` without `nameof`. - Use `PlayList` (not `Playlist`) in code; configuration POCOs end in `Configuration`; injected services are named after their type (`storageService`). - User-facing strings are in English (the web-player owns translation).