Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sonar.login is deprecated - switching to sonar.token #26

Merged
merged 6 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 61 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.4
# Updated: 20-12-2020
# Version: 1.0.0
# Updated: 25-09-2023
# Location: Root
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

##########################################
@@ -58,6 +59,12 @@ end_of_line = crlf
# Bash Files
[*.sh]
end_of_line = lf
indent_size = 2

# Powershell
[*.ps1]
end_of_line = lf
indent_size = 2

# Makefiles
[Makefile]
@@ -80,6 +87,7 @@ dotnet_separate_import_directive_groups = false
# .NET Code Style Settings
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
[*.{cs,csx,cake}]

# "this." and "Me." qualifiers
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
dotnet_style_qualification_for_field = false
@@ -139,12 +147,17 @@ dotnet_style_operator_placement_when_wrapping = end_of_line
# C# Code Style Settings
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
[*.{cs,csx,cake}]

# Implicit and explicit types
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
csharp_style_var_for_built_in_types = true # IDE0007 and IDE0008
csharp_style_var_when_type_is_apparent = true # IDE0007 and IDE0008
csharp_style_var_elsewhere = true # IDE0007 and IDE0008

# Namespace declaration preferences
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0160-ide0161?view=vs-2022
csharp_style_namespace_declarations = file_scoped # IDE0160 and IDE0161

# Expression-bodied members
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
csharp_style_expression_bodied_constructors = when_on_single_line # IDE0021
@@ -188,8 +201,8 @@ csharp_style_unused_value_assignment_preference = discard_variable

# Index and range preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
csharp_style_prefer_index_operator = true # IDE0056
csharp_style_prefer_range_operator = true # IDE0057
csharp_style_prefer_index_operator = true:suggestion # IDE0056
csharp_style_prefer_range_operator = true:suggestion # IDE0057

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

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

# Meziantou
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
dotnet_diagnostic.MA0003.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0003.md
dotnet_diagnostic.MA0004.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
dotnet_diagnostic.MA0006.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0006.md
dotnet_diagnostic.MA0011.severity = none # Duplicate of CA1305
dotnet_diagnostic.MA0016.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
dotnet_diagnostic.MA0025.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0025.md
dotnet_diagnostic.MA0026.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0026.md
dotnet_diagnostic.MA0028.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0028.md
dotnet_diagnostic.MA0038.severity = none # Duplicate of CA1822
dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0048.md


# Microsoft - Code Analysis
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
dotnet_diagnostic.CA1305.severity = error
dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
dotnet_diagnostic.CA1812.severity = none
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md


# Microsoft - Compiler Errors
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
dotnet_diagnostic.CS4014.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCompilerErrors/CS4014.md

dotnet_diagnostic.CA1014.severity = none

# SecurityCodeScan
# https://security-code-scan.github.io/
@@ -451,23 +485,43 @@ dotnet_diagnostic.CA1014.severity = none
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
dotnet_diagnostic.SA1200.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1200.md
dotnet_diagnostic.SA1201.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1201.md
dotnet_diagnostic.SA1202.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1202.md
dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
dotnet_diagnostic.SA1600.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1600.md
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
dotnet_diagnostic.SA1629.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1629.md
dotnet_diagnostic.SA1633.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1633.md
dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1649.md


# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp
dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
dotnet_diagnostic.S2629.severity = none # Don't use string interpolation in logging message templates.
dotnet_diagnostic.S6602.severity = none # "Find" method should be used instead of the "FirstOrDefault"
dotnet_diagnostic.S6603.severity = none # The collection-specific "TrueForAll" method should be used instead of the "All"
dotnet_diagnostic.S6605.severity = none # Collection-specific "Exists" method should be used instead of the "Any"


##########################################
# Custom - File Extension Settings
##########################################


##########################################
# Custom - Code Analyzers Rules
##########################################

dotnet_diagnostic.CA1014.severity = none # CA1014: Mark assemblies with CLSCompliant
dotnet_diagnostic.CA1014.severity = none #
dotnet_diagnostic.CA1859.severity = none #

dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
dotnet_diagnostic.SA1010.severity = none #
dotnet_diagnostic.SA1202.severity = none #
12 changes: 6 additions & 6 deletions .github/workflows/post-integration.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_WORKFLOWS }}
@@ -30,10 +30,10 @@ jobs:
with:
setAllVars: true

- name: ⚙️ Setup dotnet 5.0.x
uses: actions/setup-dotnet@v1
- name: ⚙️ Setup dotnet 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.0.x'
dotnet-version: '8.0.x'

- name: ⚙️ Set up JDK 17
uses: actions/setup-java@v3
@@ -62,9 +62,9 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: pwsh
run: |
dotnet sonarscanner begin /k:"atc-rest-client" /o:"atc-net" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet sonarscanner begin /k:"atc-rest-client" /o:"atc-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build -c Release /p:UseSourceLink=true --no-restore
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: ⏩ Merge to stable-branch
run: |
16 changes: 8 additions & 8 deletions .github/workflows/pre-integration.yml
Original file line number Diff line number Diff line change
@@ -15,14 +15,14 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ⚙️ Setup dotnet 5.0.x
uses: actions/setup-dotnet@v1
- name: ⚙️ Setup dotnet 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.0.x'
dotnet-version: '8.0.x'

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

- name: ⚙️ Setup dotnet 5.0.x
uses: actions/setup-dotnet@v1
- name: ⚙️ Setup dotnet 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.0.x'
dotnet-version: '8.0.x'

- name: 🔁 Restore packages
run: dotnet restore
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_WORKFLOWS }}
@@ -27,10 +27,10 @@ jobs:
with:
setAllVars: true

- name: ⚙️ Setup dotnet 5.0.x
uses: actions/setup-dotnet@v1
- name: ⚙️ Setup dotnet 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.0.x'
dotnet-version: '8.0.x'

- name: 🧹 Clean
run: dotnet clean -c Release && dotnet nuget locals all --clear
19 changes: 10 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -16,9 +16,11 @@

<PropertyGroup Label="Compile settings">
<Nullable>enable</Nullable>
<LangVersion>9.0</LangVersion>
<LangVersion>12.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1573,1591,1712</NoWarn>
<NoWarn>1573,1591,1712,CA1014,NU5104</NoWarn>

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

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

</Project>
21 changes: 17 additions & 4 deletions atc-coding-rules-updater.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
{
"Mappings": {
"Src": { "Paths": [ "src" ] },
"Test": { "Paths": [ "test" ] }
}
"projectTarget": "DotNet8",
"useLatestMinorNugetVersion": true,
"useTemporarySuppressions": false,
"temporarySuppressionAsExcel": false,
"analyzerProviderCollectingMode": "LocalCache",
"mappings": {
"src": {
"paths": [
"src"
]
},
"test": {
"paths": [
"test"
]
}
}
}
5 changes: 3 additions & 2 deletions atc-coding-rules-updater.ps1
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ $currentPath = Get-Location

Write-Host "Running atc-coding-rules-updater to fetch updated rulesets and configurations"
atc-coding-rules-updater `
-r $currentPath `
run `
-p $currentPath `
--optionsPath $currentPath'\atc-coding-rules-updater.json' `
-v true
--verbose
13 changes: 9 additions & 4 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.2
# Updated: 10-12-2020
# Location: Src
# Version: 1.0.0
# Updated: 25-09-2023
# Location: src
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

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


# Microsoft - Compiler Errors
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/


# SecurityCodeScan
# https://security-code-scan.github.io/

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

##########################################
# Custom - Code Analyzers Rules
##########################################
##########################################
10 changes: 5 additions & 5 deletions src/Atc.Rest.Client/Atc.Rest.Client.csproj
Original file line number Diff line number Diff line change
@@ -9,14 +9,14 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="System.Text.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nullable" Version="1.3.0">
<PackageReference Include="Nullable" Version="1.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Loading