@@ -84,6 +84,10 @@ spelling_checkable_types = # NEW
8484# Default Severity for all .NET Code Style rules below
8585dotnet_analyzer_diagnostic.severity = warning
8686
87+ # VSSpell001: Spell Check
88+ dotnet_diagnostic.VSSpell001.severity = suggestion
89+ dotnet_diagnostic.VSSpell002.severity = suggestion
90+
8791# #########################################
8892# Language Rules - .NET
8993# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules
@@ -162,6 +166,7 @@ dotnet_diagnostic.IDE0063.severity = suggestion
162166csharp_style_namespace_declarations = file_scoped
163167csharp_style_prefer_method_group_conversion = true # NEW
164168csharp_style_prefer_top_level_statements = true # NEW
169+ dotnet_diagnostic.IDE0290.severity = suggestion # NEW - Use primary constructor
165170
166171# Expression-bodied members
167172csharp_style_expression_bodied_constructors = true
@@ -189,6 +194,11 @@ csharp_style_implicit_object_creation_when_type_is_apparent = true
189194csharp_style_prefer_null_check_over_type_check = true
190195csharp_style_prefer_tuple_swap = true # NEW
191196csharp_style_prefer_utf8_string_literals = true # NEW
197+ dotnet_diagnostic.IDE0028.severity = suggestion # NEW - Use collection initializers
198+ dotnet_diagnostic.IDE0090.severity = suggestion # NEW - Simplify new expression
199+ dotnet_diagnostic.IDE0300.severity = suggestion # NEW - Collection initialization can be simplified
200+ dotnet_diagnostic.IDE0301.severity = suggestion # NEW - Collection initialization can be simplified
201+ dotnet_diagnostic.IDE0305.severity = suggestion # NEW - Collection initialization can be simplified
192202
193203# Modifier preferences
194204csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
@@ -294,6 +304,27 @@ csharp_space_between_square_brackets = false
294304csharp_preserve_single_line_statements = false
295305csharp_preserve_single_line_blocks = true
296306
307+ # #########################################
308+ # Code Quality Rules - C#
309+ # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
310+ # #########################################
311+
312+ [* .{cs,csx,cake} ]
313+
314+ # Usage rules
315+ # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/usage-warnings
316+ dotnet_diagnostic.CA2249.severity = suggestion # NEW - Consider using String.Contains instead of String.IndexOf
317+
318+ # Performance rules
319+ # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/performance-warnings
320+ dotnet_diagnostic.CA1854.severity = suggestion # NEW - Prefer the IDictionary.TryGetValue(TKey, out TValue) method
321+ dotnet_diagnostic.CA1859.severity = suggestion # NEW - Use concrete types when possible for improved performance
322+ dotnet_diagnostic.CA1861.severity = suggestion # NEW - Avoid constant arrays as arguments
323+ dotnet_diagnostic.CA1865.severity = suggestion # NEW - Use ' string.Method(char)' instead of ' string.Method(string)' for string with single char
324+ dotnet_diagnostic.CA1866.severity = suggestion # NEW - Use ' string.Method(char)' instead of ' string.Method(string)' for string with single char
325+ dotnet_diagnostic.CA1867.severity = suggestion # NEW - Use ' string.Method(char)' instead of ' string.Method(string)' for string with single char
326+ dotnet_diagnostic.CA1869.severity = suggestion # NEW - Cache and reuse ' JsonSerializerOptions' instances
327+
297328# #########################################
298329# .NET Naming Rules
299330# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules
0 commit comments