Skip to content

Commit

Permalink
chore: Update coding-rules to .net8 and update anzlyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkallesen committed Nov 15, 2023
1 parent 6399ffd commit 520b529
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 25 deletions.
13 changes: 10 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.9
# Updated: 01-02-2022
# Version: 1.0.0
# Updated: 25-09-2023
# Location: Root
# Distribution: DotNet6
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

##########################################
Expand Down Expand Up @@ -87,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
Expand Down Expand Up @@ -146,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
Expand Down Expand Up @@ -457,6 +463,7 @@ dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net
dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
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


Expand Down
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +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="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="1.0.695" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.0" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.110" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.36.0.43782" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982" PrivateAssets="All" />
</ItemGroup>

</Project>
29 changes: 23 additions & 6 deletions atc-coding-rules-updater.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
{
"Mappings": {
"Sample": { "Paths": [ "sample" ] },
"Src": { "Paths": [ "src" ] },
"Test": { "Paths": [ "test" ] }
}
{
"projectTarget": "DotNet8",
"useLatestMinorNugetVersion": true,
"useTemporarySuppressions": false,
"temporarySuppressionAsExcel": false,
"analyzerProviderCollectingMode": "LocalCache",
"mappings": {
"sample": {
"paths": [
"sample"
]
},
"src": {
"paths": [
"src"
]
},
"test": {
"paths": [
"test"
]
}
}
}
6 changes: 3 additions & 3 deletions sample/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.9
# Updated: 01-02-2022
# Version: 1.0.0
# Updated: 25-09-2023
# Location: sample
# Distribution: DotNet6
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

##########################################
Expand Down
6 changes: 3 additions & 3 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.9
# Updated: 01-02-2022
# Version: 1.0.0
# Updated: 25-09-2023
# Location: src
# Distribution: DotNet6
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

##########################################
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.255" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="All" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions test/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.9
# Updated: 01-02-2022
# Version: 1.0.0
# Updated: 25-09-2023
# Location: test
# Distribution: DotNet6
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options

##########################################
Expand Down
4 changes: 2 additions & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Test" Version="1.0.58" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.15" PrivateAssets="All" />
<PackageReference Include="Atc.Test" Version="1.0.79" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 520b529

Please sign in to comment.