Skip to content

Commit 238a249

Browse files
committed
chore: update ATC coding rules to DotNet10
1 parent 5332d3c commit 238a249

8 files changed

Lines changed: 274 additions & 18 deletions

File tree

.editorconfig

Lines changed: 116 additions & 8 deletions
Large diffs are not rendered by default.

atc-coding-rules-updater.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"projectTarget": "DotNet10",
3+
"mappings": {
4+
"src": {
5+
"paths": [
6+
"src"
7+
]
8+
},
9+
"test": {
10+
"paths": [
11+
"test"
12+
]
13+
},
14+
"sample": {
15+
"paths": [
16+
"sample"
17+
]
18+
}
19+
}
20+
}

atc-coding-rules-updater.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Clear-Host
2+
Write-Host "Updating atc-coding-rules-updater tool to newest version"
3+
dotnet tool update -g atc-coding-rules-updater
4+
5+
$currentPath = Get-Location
6+
7+
Write-Host "Running atc-coding-rules-updater to fetch updated rulesets and configurations"
8+
atc-coding-rules-updater `
9+
run `
10+
-p $currentPath `
11+
--optionsPath $currentPath'\atc-coding-rules-updater.json' `
12+
--verbose

sample/.editorconfig

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2+
# Version: 1.0.0
3+
# Updated: 27-11-2025
4+
# Location: sample
5+
# Distribution: DotNet10
6+
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
7+
8+
##########################################
9+
# Code Analyzers Rules
10+
##########################################
11+
[*.{cs,csx,cake}]
12+
13+
# AsyncFixer
14+
# http://www.asyncfixer.com
15+
16+
17+
# Asyncify
18+
# https://github.com/hvanbakel/Asyncify-CSharp
19+
20+
21+
# Meziantou
22+
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
23+
24+
25+
# Microsoft - Code Analysis
26+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
27+
28+
29+
# Microsoft - Compiler Errors
30+
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
31+
32+
33+
# Microsoft - FxCop
34+
# https://github.com/dotnet/roslyn-analyzers
35+
36+
37+
# SecurityCodeScan
38+
# https://security-code-scan.github.io/
39+
40+
41+
# StyleCop
42+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
43+
44+
# SonarAnalyzer.CSharp
45+
# https://rules.sonarsource.com/csharp
46+
47+
dotnet_diagnostic.S1075.severity = none # Refactor your code not to use hardcoded absolute paths or URIs
48+
49+
##########################################
50+
# Custom - Code Analyzers Rules
51+
##########################################

sample/Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!--
5+
Add any shared properties you want for the projects under this directory that need to be set before the auto imported Directory.Build.props
6+
-->
7+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
8+
9+
<!-- Place any common sample properties here -->
10+
11+
</Project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2+
# Version: 1.0.2
3+
# Updated: 03-06-2024
4+
# Location: webapi
5+
# Distribution: Frameworks
6+
7+
##########################################
8+
# Code Analyzers Rules
9+
##########################################
10+
[*.{cs}]
11+
12+
dotnet_diagnostic.ASP0000.severity = error # Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices' - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0000?view=aspnetcore-8.0
13+
dotnet_diagnostic.ASP0001.severity = error # Authorization middleware is incorrectly configured - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/ASP0001?view=aspnetcore-8.0
14+
dotnet_diagnostic.ASP0003.severity = error # Do not use model binding attributes with route handlers - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0003?view=aspnetcore-8.0
15+
dotnet_diagnostic.ASP0004.severity = error # Do not use action results with route handlers - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0004?view=aspnetcore-8.0
16+
dotnet_diagnostic.ASP0005.severity = error # Do not place attribute on method called by route handler lambda - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0005?view=aspnetcore-8.0
17+
dotnet_diagnostic.ASP0007.severity = error # Route parameter and argument optionality is mismatched - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0007?view=aspnetcore-8.0
18+
dotnet_diagnostic.ASP0008.severity = error # Do not use ConfigureWebHost with WebApplicationBuilder.Host - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0008?view=aspnetcore-8.0
19+
dotnet_diagnostic.ASP0009.severity = error # Do not use Configure with WebApplicationBuilder.WebHost - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0009?view=aspnetcore-8.0
20+
dotnet_diagnostic.ASP0010.severity = error # Do not use UseStartup with WebApplicationBuilder.WebHost - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0010?view=aspnetcore-8.0
21+
dotnet_diagnostic.ASP0011.severity = suggestion # Suggest using builder.Logging over Host.ConfigureLogging or WebHost.ConfigureLogging - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0011?view=aspnetcore-8.0
22+
dotnet_diagnostic.ASP0012.severity = suggestion # Suggest using builder.Services over Host.ConfigureServices or WebHost.ConfigureServices - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0012?view=aspnetcore-8.0
23+
dotnet_diagnostic.ASP0013.severity = suggestion # Suggest switching from using Configure methods to WebApplicationBuilder.Configuration - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0013?view=aspnetcore-8.0
24+
dotnet_diagnostic.ASP0014.severity = suggestion # Suggest using top level route registrations - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0014?view=aspnetcore-8.0
25+
dotnet_diagnostic.ASP0015.severity = suggestion # Suggest using IHeaderDictionary properties - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0015?view=aspnetcore-8.0
26+
dotnet_diagnostic.ASP0016.severity = error # Do not return a value from RequestDelegate - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0016?view=aspnetcore-8.0
27+
dotnet_diagnostic.ASP0017.severity = error # Invalid route pattern - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0017?view=aspnetcore-8.0
28+
dotnet_diagnostic.ASP0018.severity = suggestion # Unused route parameter - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0018?view=aspnetcore-8.0
29+
dotnet_diagnostic.ASP0019.severity = suggestion # Suggest using IHeaderDictionary.Append or the indexer - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0019?view=aspnetcore-8.0
30+
dotnet_diagnostic.ASP0020.severity = none # Complex types referenced by route parameters must be parsable - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0020?view=aspnetcore-8.0
31+
dotnet_diagnostic.ASP0021.severity = none # The return type of the BindAsync method must be ValueTask<T> - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0021?view=aspnetcore-8.0
32+
dotnet_diagnostic.ASP0022.severity = error # Route conflict detected between route handlers (Minimal API) - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0022?view=aspnetcore-8.0
33+
dotnet_diagnostic.ASP0023.severity = error # Route conflict detected between route handlers (MVC) - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0023?view=aspnetcore-8.0
34+
dotnet_diagnostic.ASP0024.severity = error # Route handler has multiple parameters with the [FromBody] attribute - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0024?view=aspnetcore-8.0
35+
dotnet_diagnostic.ASP0025.severity = suggestion # Use AddAuthorizationBuilder to register authorization services and construct policies - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0025?view=aspnetcore-8.0
36+
37+
dotnet_diagnostic.CA1062.severity = none # No need for null-checking in public method.
38+
39+
dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait(false) https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md
40+
41+
dotnet_diagnostic.S6964.severity = none # The rule S6964 should not be active for model properties that use the required keyword. Those properties can never be under-posted because the JSON deserialization for them fails.
42+
43+
##########################################
44+
# Custom - Code Analyzers Rules
45+
##########################################

src/.editorconfig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2-
# Version: 1.0.2
3-
# Updated: 10-12-2020
4-
# Location: Src
2+
# Version: 1.0.0
3+
# Updated: 27-11-2025
4+
# Location: src
5+
# Distribution: DotNet10
56
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
67

78
##########################################
@@ -25,8 +26,8 @@
2526
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
2627

2728

28-
# Microsoft - Threading
29-
# https://github.com/microsoft/vs-threading/blob/master/doc/analyzers/index.md
29+
# Microsoft - Compiler Errors
30+
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
3031

3132

3233
# SecurityCodeScan

test/.editorconfig

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2-
# Version: 1.0.3
3-
# Updated: 20-12-2020
4-
# Location: Test
2+
# Version: 1.0.0
3+
# Updated: 27-11-2025
4+
# Location: test
5+
# Distribution: DotNet10
56
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
67

78
##########################################
@@ -19,15 +20,21 @@
1920

2021
# Meziantou
2122
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
23+
dotnet_diagnostic.MA0004.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
24+
dotnet_diagnostic.MA0016.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
25+
dotnet_diagnostic.MA0051.severity = none # Method Length
2226

2327

2428
# Microsoft - Code Analysis
2529
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
30+
dotnet_diagnostic.CA1068.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
31+
dotnet_diagnostic.CA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1602.md
2632
dotnet_diagnostic.CA1707.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
33+
dotnet_diagnostic.CA2007.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
2734

2835

29-
# Microsoft - Threading
30-
# https://github.com/microsoft/vs-threading/blob/master/doc/analyzers/index.md
36+
# Microsoft - Compiler Errors
37+
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
3138

3239

3340
# SecurityCodeScan
@@ -36,6 +43,7 @@ dotnet_diagnostic.CA1707.severity = none # https://github.com/atc-net
3643

3744
# StyleCop
3845
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
46+
dotnet_diagnostic.SA1122.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
3947
dotnet_diagnostic.SA1133.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
4048

4149

0 commit comments

Comments
 (0)