11# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2- # Version: 1.0.0
3- # Updated: 25-09-2023
2+ # Version: 1.0.1
3+ # Updated: 03-06-2024
44# Location: Root
55# Distribution: DotNet8
66# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
@@ -464,12 +464,58 @@ dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net
464464dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
465465dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
466466dotnet_diagnostic.CA1305.severity = error
467+ dotnet_diagnostic.CA1308.severity = suggestion # Normalize strings to uppercase
468+ dotnet_diagnostic.CA1510.severity = suggestion # Use ArgumentNullException throw helper
469+ dotnet_diagnostic.CA1511.severity = suggestion # Use ArgumentException throw helper
470+ dotnet_diagnostic.CA1512.severity = suggestion # Use ArgumentOutOfRangeException throw helper
471+ dotnet_diagnostic.CA1513.severity = suggestion # Use ObjectDisposedException throw helper
472+ dotnet_diagnostic.CA1514.severity = error # Avoid redundant length argument
473+ dotnet_diagnostic.CA1515.severity = suggestion # Because an application's API isn't typically referenced from outside the assembly, types can be made internal (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515)
467474dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
468475dotnet_diagnostic.CA1812.severity = none
469476dotnet_diagnostic.CA1822.severity = suggestion
477+ dotnet_diagnostic.CA1849.severity = error # Call async methods when in an async method
478+ dotnet_diagnostic.CA1854.severity = suggestion # Prefer the ' IDictionary.TryGetValue(TKey, out TValue)' method
479+ dotnet_diagnostic.CA1855.severity = suggestion # Prefer ' Clear' over ' Fill'
480+ dotnet_diagnostic.CA1856.severity = error # Incorrect usage of ConstantExpected attribute
481+ dotnet_diagnostic.CA1857.severity = suggestion # A constant is expected for the parameter
482+ dotnet_diagnostic.CA1858.severity = suggestion # Use ' StartsWith' instead of ' IndexOf'
483+ dotnet_diagnostic.CA1859.severity = suggestion # Use concrete types when possible for improved performance
484+ dotnet_diagnostic.CA1860.severity = suggestion # Avoid using ' Enumerable.Any()' extension method
485+ dotnet_diagnostic.CA1861.severity = suggestion # Avoid constant arrays as arguments
486+ dotnet_diagnostic.CA1862.severity = error # Use the ' StringComparison' method overloads to perform case-insensitive string comparisons
487+ dotnet_diagnostic.CA1863.severity = suggestion # Use ' CompositeFormat'
488+ dotnet_diagnostic.CA1864.severity = suggestion # Prefer the ' IDictionary.TryAdd(TKey, TValue)' method
489+ dotnet_diagnostic.CA1865.severity = suggestion # Use char overload
490+ dotnet_diagnostic.CA1866.severity = suggestion # Use char overload
491+ dotnet_diagnostic.CA1867.severity = suggestion # Use char overload
492+ dotnet_diagnostic.CA1868.severity = suggestion # Unnecessary call to ' Contains(item)'
493+ dotnet_diagnostic.CA1869.severity = suggestion # Cache and reuse ' JsonSerializerOptions' instances
494+ dotnet_diagnostic.CA1870.severity = suggestion # Use a cached ' SearchValues' instance
470495dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
496+ dotnet_diagnostic.CA2017.severity = error # Parameter count mismatch
497+ dotnet_diagnostic.CA2018.severity = error # The count argument to Buffer.BlockCopy should specify the number of bytes to copy
498+ dotnet_diagnostic.CA2019.severity = error # ThreadStatic fields should not use inline initialization
499+ dotnet_diagnostic.CA2021.severity = error # Don't call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
500+ dotnet_diagnostic.CA2250.severity = suggestion # Use ThrowIfCancellationRequested
501+ dotnet_diagnostic.CA2252.severity = suggestion # Opt-in to preview features should be used with caution
502+ dotnet_diagnostic.CA2253.severity = error # Named placeholders should not be numeric values
503+ dotnet_diagnostic.CA2254.severity = suggestion # Template should be a static expression
504+ dotnet_diagnostic.CA2255.severity = suggestion # The ModuleInitializer attribute should not be used in libraries
505+ dotnet_diagnostic.CA2259.severity = error # Ensure ThreadStatic is only used with static fields
506+ dotnet_diagnostic.CA2260.severity = error # Implement generic math interfaces correctly
507+ dotnet_diagnostic.CA2261.severity = error # Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
471508dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
509+ dotnet_diagnostic.IDE0010.severity = suggestion # Populate switch
510+ dotnet_diagnostic.IDE0028.severity = suggestion # Collection initialization can be simplified
511+ dotnet_diagnostic.IDE0021.severity = suggestion # Use expression body for constructor
512+ dotnet_diagnostic.IDE0055.severity = none # Fix formatting
472513dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md
514+ dotnet_diagnostic.IDE0061.severity = suggestion # Use expression body for local function
515+ dotnet_diagnostic.IDE0130.severity = suggestion # Namespace does not match folder structure
516+ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
517+ dotnet_diagnostic.IDE0301.severity = suggestion # Use collection expression for empty
518+ dotnet_diagnostic.IDE0305.severity = suggestion # Collection initialization can be simplified
473519
474520
475521# Microsoft - Compiler Errors
@@ -484,6 +530,7 @@ dotnet_diagnostic.CS4014.severity = error # https://github.com/atc-net/
484530# StyleCop
485531# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
486532dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
533+ dotnet_diagnostic.SA1010.severity = none # False positive when using collection initializers
487534dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
488535dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
489536dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
@@ -505,6 +552,11 @@ dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net
505552# SonarAnalyzer.CSharp
506553# https://rules.sonarsource.com/csharp
507554dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
555+ dotnet_diagnostic.S2629.severity = none # Don't use string interpolation in logging message templates.
556+ dotnet_diagnostic.S3358.severity = none # Extract this nested ternary operation into an independent statement.
557+ dotnet_diagnostic.S6602.severity = none # " Find" method should be used instead of the " FirstOrDefault"
558+ dotnet_diagnostic.S6603.severity = none # The collection-specific " TrueForAll" method should be used instead of the " All"
559+ dotnet_diagnostic.S6605.severity = none # Collection-specific " Exists" method should be used instead of the " Any"
508560
509561
510562# #########################################
0 commit comments