Skip to content

Commit 86a2b78

Browse files
authored
Merge pull request #26 from atc-net/feature/sonarcloud.token
sonar.login is deprecated - switching to sonar.token
2 parents 7e662e1 + 090d8a5 commit 86a2b78

36 files changed

+1270
-1220
lines changed

.editorconfig

+61-7
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.4
3-
# Updated: 20-12-2020
2+
# Version: 1.0.0
3+
# Updated: 25-09-2023
44
# Location: Root
5+
# Distribution: DotNet8
56
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
67

78
##########################################
@@ -58,6 +59,12 @@ end_of_line = crlf
5859
# Bash Files
5960
[*.sh]
6061
end_of_line = lf
62+
indent_size = 2
63+
64+
# Powershell
65+
[*.ps1]
66+
end_of_line = lf
67+
indent_size = 2
6168

6269
# Makefiles
6370
[Makefile]
@@ -80,6 +87,7 @@ dotnet_separate_import_directive_groups = false
8087
# .NET Code Style Settings
8188
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
8289
[*.{cs,csx,cake}]
90+
8391
# "this." and "Me." qualifiers
8492
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
8593
dotnet_style_qualification_for_field = false
@@ -139,12 +147,17 @@ dotnet_style_operator_placement_when_wrapping = end_of_line
139147
# C# Code Style Settings
140148
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
141149
[*.{cs,csx,cake}]
150+
142151
# Implicit and explicit types
143152
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
144153
csharp_style_var_for_built_in_types = true # IDE0007 and IDE0008
145154
csharp_style_var_when_type_is_apparent = true # IDE0007 and IDE0008
146155
csharp_style_var_elsewhere = true # IDE0007 and IDE0008
147156

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+
148161
# Expression-bodied members
149162
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
150163
csharp_style_expression_bodied_constructors = when_on_single_line # IDE0021
@@ -188,8 +201,8 @@ csharp_style_unused_value_assignment_preference = discard_variable
188201

189202
# Index and range preferences
190203
# 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
193206

194207
# Miscellaneous preferences
195208
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
@@ -252,6 +265,7 @@ csharp_space_between_square_brackets = false
252265
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
253266
csharp_preserve_single_line_statements = false
254267
csharp_preserve_single_line_blocks = true
268+
csharp_style_namespace_declarations = file_scoped:suggestion
255269

256270
##########################################
257271
# .NET Naming Conventions
@@ -433,15 +447,35 @@ dotnet_naming_rule.parameters_rule.severity = warning
433447

434448
# Meziantou
435449
# 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
436454
dotnet_diagnostic.MA0016.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
437455
dotnet_diagnostic.MA0025.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0025.md
438456
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
439460

440461

441462
# Microsoft - Code Analysis
442463
# 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
443478

444-
dotnet_diagnostic.CA1014.severity = none
445479

446480
# SecurityCodeScan
447481
# https://security-code-scan.github.io/
@@ -451,23 +485,43 @@ dotnet_diagnostic.CA1014.severity = none
451485
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
452486
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
453487
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
454490
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
455494
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
456495
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
457497
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
458498
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
459501
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
460503

461504

462505
# SonarAnalyzer.CSharp
463506
# https://rules.sonarsource.com/csharp
464507
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+
##########################################
465517

466518

467519
##########################################
468520
# Custom - Code Analyzers Rules
469521
##########################################
470522

471-
dotnet_diagnostic.CA1014.severity = none # CA1014: Mark assemblies with CLSCompliant
523+
dotnet_diagnostic.CA1014.severity = none #
524+
dotnet_diagnostic.CA1859.severity = none #
472525

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 #

.github/workflows/post-integration.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: 🛒 Checkout repository
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
2323
token: ${{ secrets.PAT_WORKFLOWS }}
@@ -30,10 +30,10 @@ jobs:
3030
with:
3131
setAllVars: true
3232

33-
- name: ⚙️ Setup dotnet 5.0.x
34-
uses: actions/setup-dotnet@v1
33+
- name: ⚙️ Setup dotnet 8.0.x
34+
uses: actions/setup-dotnet@v4
3535
with:
36-
dotnet-version: '5.0.x'
36+
dotnet-version: '8.0.x'
3737

3838
- name: ⚙️ Set up JDK 17
3939
uses: actions/setup-java@v3
@@ -62,9 +62,9 @@ jobs:
6262
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6363
shell: pwsh
6464
run: |
65-
dotnet sonarscanner begin /k:"atc-rest-client" /o:"atc-net" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
65+
dotnet sonarscanner begin /k:"atc-rest-client" /o:"atc-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
6666
dotnet build -c Release /p:UseSourceLink=true --no-restore
67-
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
67+
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
6868
6969
- name: ⏩ Merge to stable-branch
7070
run: |

.github/workflows/pre-integration.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
steps:
1717
- name: 🛒 Checkout repository
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
2121

22-
- name: ⚙️ Setup dotnet 5.0.x
23-
uses: actions/setup-dotnet@v1
22+
- name: ⚙️ Setup dotnet 8.0.x
23+
uses: actions/setup-dotnet@v4
2424
with:
25-
dotnet-version: '5.0.x'
25+
dotnet-version: '8.0.x'
2626

2727
- name: 🧹 Clean
2828
run: dotnet clean -c Release && dotnet nuget locals all --clear
@@ -39,14 +39,14 @@ jobs:
3939
- dotnet5-build
4040
steps:
4141
- name: 🛒 Checkout repository
42-
uses: actions/checkout@v2
42+
uses: actions/checkout@v4
4343
with:
4444
fetch-depth: 0
4545

46-
- name: ⚙️ Setup dotnet 5.0.x
47-
uses: actions/setup-dotnet@v1
46+
- name: ⚙️ Setup dotnet 8.0.x
47+
uses: actions/setup-dotnet@v4
4848
with:
49-
dotnet-version: '5.0.x'
49+
dotnet-version: '8.0.x'
5050

5151
- name: 🔁 Restore packages
5252
run: dotnet restore

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: 🛒 Checkout repository
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0
2020
token: ${{ secrets.PAT_WORKFLOWS }}
@@ -27,10 +27,10 @@ jobs:
2727
with:
2828
setAllVars: true
2929

30-
- name: ⚙️ Setup dotnet 5.0.x
31-
uses: actions/setup-dotnet@v1
30+
- name: ⚙️ Setup dotnet 8.0.x
31+
uses: actions/setup-dotnet@v4
3232
with:
33-
dotnet-version: '5.0.x'
33+
dotnet-version: '8.0.x'
3434

3535
- name: 🧹 Clean
3636
run: dotnet clean -c Release && dotnet nuget locals all --clear

Directory.Build.props

+10-9
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
<PropertyGroup Label="Compile settings">
1818
<Nullable>enable</Nullable>
19-
<LangVersion>9.0</LangVersion>
19+
<LangVersion>12.0</LangVersion>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
<TargetFramework>net8.0</TargetFramework>
2022
<GenerateDocumentationFile>true</GenerateDocumentationFile>
21-
<NoWarn>1573,1591,1712</NoWarn>
23+
<NoWarn>1573,1591,1712,CA1014,NU5104</NoWarn>
2224

2325
<!-- Used by code coverage -->
2426
<DebugType>full</DebugType>
@@ -39,13 +41,12 @@
3941

4042
<!-- Shared code analyzers used for all projects in the solution -->
4143
<ItemGroup Label="Code Analyzers">
42-
<PackageReference Include="AsyncFixer" Version="1.5.1" PrivateAssets="All" />
43-
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="all" />
44-
<PackageReference Include="Meziantou.Analyzer" Version="1.0.646" PrivateAssets="all" />
45-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="All" />
46-
<PackageReference Include="SecurityCodeScan" Version="3.5.3" PrivateAssets="all" />
47-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
48-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.17.0.26580" PrivateAssets="all" />
44+
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
45+
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
46+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.150" PrivateAssets="All" />
47+
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
48+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
49+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.25.0.90414" PrivateAssets="All" />
4950
</ItemGroup>
5051

5152
</Project>

atc-coding-rules-updater.json

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
2-
"Mappings": {
3-
"Src": { "Paths": [ "src" ] },
4-
"Test": { "Paths": [ "test" ] }
5-
}
2+
"projectTarget": "DotNet8",
3+
"useLatestMinorNugetVersion": true,
4+
"useTemporarySuppressions": false,
5+
"temporarySuppressionAsExcel": false,
6+
"analyzerProviderCollectingMode": "LocalCache",
7+
"mappings": {
8+
"src": {
9+
"paths": [
10+
"src"
11+
]
12+
},
13+
"test": {
14+
"paths": [
15+
"test"
16+
]
17+
}
18+
}
619
}

atc-coding-rules-updater.ps1

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $currentPath = Get-Location
66

77
Write-Host "Running atc-coding-rules-updater to fetch updated rulesets and configurations"
88
atc-coding-rules-updater `
9-
-r $currentPath `
9+
run `
10+
-p $currentPath `
1011
--optionsPath $currentPath'\atc-coding-rules-updater.json' `
11-
-v true
12+
--verbose

src/.editorconfig

+9-4
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: 25-09-2023
4+
# Location: src
5+
# Distribution: DotNet8
56
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
67

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

2728

29+
# Microsoft - Compiler Errors
30+
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
31+
32+
2833
# SecurityCodeScan
2934
# https://security-code-scan.github.io/
3035

@@ -39,4 +44,4 @@
3944

4045
##########################################
4146
# Custom - Code Analyzers Rules
42-
##########################################
47+
##########################################

src/Atc.Rest.Client/Atc.Rest.Client.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
12-
<PackageReference Include="System.Text.Json" Version="5.0.0" />
13-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
14-
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
15-
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
12+
<PackageReference Include="System.Text.Json" Version="8.0.3" />
13+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
14+
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
15+
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Nullable" Version="1.3.0">
19+
<PackageReference Include="Nullable" Version="1.3.1">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2222
</PackageReference>

0 commit comments

Comments
 (0)