1
1
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2
- # Version: 1.0.4
3
- # Updated: 20-12-2020
2
+ # Version: 1.0.0
3
+ # Updated: 25-09-2023
4
4
# Location: Root
5
+ # Distribution: DotNet8
5
6
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
6
7
7
8
# #########################################
@@ -58,6 +59,12 @@ end_of_line = crlf
58
59
# Bash Files
59
60
[* .sh ]
60
61
end_of_line = lf
62
+ indent_size = 2
63
+
64
+ # Powershell
65
+ [* .ps1 ]
66
+ end_of_line = lf
67
+ indent_size = 2
61
68
62
69
# Makefiles
63
70
[Makefile ]
@@ -80,6 +87,7 @@ dotnet_separate_import_directive_groups = false
80
87
# .NET Code Style Settings
81
88
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
82
89
[* .{cs,csx,cake} ]
90
+
83
91
# "this." and "Me." qualifiers
84
92
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
85
93
dotnet_style_qualification_for_field = false
@@ -139,12 +147,17 @@ dotnet_style_operator_placement_when_wrapping = end_of_line
139
147
# C# Code Style Settings
140
148
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
141
149
[* .{cs,csx,cake} ]
150
+
142
151
# Implicit and explicit types
143
152
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
144
153
csharp_style_var_for_built_in_types = true # IDE0007 and IDE0008
145
154
csharp_style_var_when_type_is_apparent = true # IDE0007 and IDE0008
146
155
csharp_style_var_elsewhere = true # IDE0007 and IDE0008
147
156
157
+ # Namespace declaration preferences
158
+ # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0160-ide0161?view=vs-2022
159
+ csharp_style_namespace_declarations = file_scoped # IDE0160 and IDE0161
160
+
148
161
# Expression-bodied members
149
162
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
150
163
csharp_style_expression_bodied_constructors = when_on_single_line # IDE0021
@@ -188,8 +201,8 @@ csharp_style_unused_value_assignment_preference = discard_variable
188
201
189
202
# Index and range preferences
190
203
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
191
- csharp_style_prefer_index_operator = true # IDE0056
192
- csharp_style_prefer_range_operator = true # IDE0057
204
+ csharp_style_prefer_index_operator = true : suggestion # IDE0056
205
+ csharp_style_prefer_range_operator = true : suggestion # IDE0057
193
206
194
207
# Miscellaneous preferences
195
208
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
@@ -252,6 +265,7 @@ csharp_space_between_square_brackets = false
252
265
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
253
266
csharp_preserve_single_line_statements = false
254
267
csharp_preserve_single_line_blocks = true
268
+ csharp_style_namespace_declarations = file_scoped:suggestion
255
269
256
270
# #########################################
257
271
# .NET Naming Conventions
@@ -433,15 +447,35 @@ dotnet_naming_rule.parameters_rule.severity = warning
433
447
434
448
# Meziantou
435
449
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
450
+ dotnet_diagnostic.MA0003.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0003.md
451
+ dotnet_diagnostic.MA0004.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
452
+ dotnet_diagnostic.MA0006.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0006.md
453
+ dotnet_diagnostic.MA0011.severity = none # Duplicate of CA1305
436
454
dotnet_diagnostic.MA0016.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
437
455
dotnet_diagnostic.MA0025.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0025.md
438
456
dotnet_diagnostic.MA0026.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0026.md
457
+ dotnet_diagnostic.MA0028.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0028.md
458
+ dotnet_diagnostic.MA0038.severity = none # Duplicate of CA1822
459
+ dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0048.md
439
460
440
461
441
462
# Microsoft - Code Analysis
442
463
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
464
+ dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
465
+ dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
466
+ dotnet_diagnostic.CA1305.severity = error
467
+ dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
468
+ dotnet_diagnostic.CA1812.severity = none
469
+ dotnet_diagnostic.CA1822.severity = suggestion
470
+ dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
471
+ dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
472
+ dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md
473
+
474
+
475
+ # Microsoft - Compiler Errors
476
+ # https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
477
+ dotnet_diagnostic.CS4014.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCompilerErrors/CS4014.md
443
478
444
- dotnet_diagnostic.CA1014.severity = none
445
479
446
480
# SecurityCodeScan
447
481
# https://security-code-scan.github.io/
@@ -451,23 +485,43 @@ dotnet_diagnostic.CA1014.severity = none
451
485
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
452
486
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
453
487
dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
488
+ dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
489
+ dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
454
490
dotnet_diagnostic.SA1200.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1200.md
491
+ dotnet_diagnostic.SA1201.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1201.md
492
+ dotnet_diagnostic.SA1202.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1202.md
493
+ dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
455
494
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
456
495
dotnet_diagnostic.SA1600.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1600.md
496
+ dotnet_diagnostic.SA1601.severity = none
457
497
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
458
498
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
499
+ dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
500
+ dotnet_diagnostic.SA1629.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1629.md
459
501
dotnet_diagnostic.SA1633.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1633.md
502
+ dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1649.md
460
503
461
504
462
505
# SonarAnalyzer.CSharp
463
506
# https://rules.sonarsource.com/csharp
464
507
dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
508
+ dotnet_diagnostic.S2629.severity = none # Don't use string interpolation in logging message templates.
509
+ dotnet_diagnostic.S6602.severity = none # " Find" method should be used instead of the " FirstOrDefault"
510
+ dotnet_diagnostic.S6603.severity = none # The collection-specific " TrueForAll" method should be used instead of the " All"
511
+ dotnet_diagnostic.S6605.severity = none # Collection-specific " Exists" method should be used instead of the " Any"
512
+
513
+
514
+ # #########################################
515
+ # Custom - File Extension Settings
516
+ # #########################################
465
517
466
518
467
519
# #########################################
468
520
# Custom - Code Analyzers Rules
469
521
# #########################################
470
522
471
- dotnet_diagnostic.CA1014.severity = none # CA1014: Mark assemblies with CLSCompliant
523
+ dotnet_diagnostic.CA1014.severity = none #
524
+ dotnet_diagnostic.CA1859.severity = none #
472
525
473
- dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
526
+ dotnet_diagnostic.SA1010.severity = none #
527
+ dotnet_diagnostic.SA1202.severity = none #
0 commit comments