Skip to content

Commit 1d79cc7

Browse files
author
Per Kops
committed
chore: update nuget packages and coding rules
1 parent ad2481d commit 1d79cc7

File tree

5 files changed

+52
-22
lines changed

5 files changed

+52
-22
lines changed

.editorconfig

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2-
# Version: 1.0.0
3-
# Updated: 25-09-2023
2+
# Version: 1.0.1
3+
# Updated: 03-06-2024
44
# Location: Root
55
# Distribution: DotNet8
66
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
@@ -464,10 +464,46 @@ dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net
464464
dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
465465
dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
466466
dotnet_diagnostic.CA1305.severity = error
467+
dotnet_diagnostic.CA1308.severity = suggestion # Normalize strings to uppercase
468+
dotnet_diagnostic.CA1510.severity = suggestion # Use ArgumentNullException throw helper
469+
dotnet_diagnostic.CA1511.severity = suggestion # Use ArgumentException throw helper
470+
dotnet_diagnostic.CA1512.severity = suggestion # Use ArgumentOutOfRangeException throw helper
471+
dotnet_diagnostic.CA1513.severity = suggestion # Use ObjectDisposedException throw helper
472+
dotnet_diagnostic.CA1514.severity = error # Avoid redundant length argument
467473
dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
468474
dotnet_diagnostic.CA1812.severity = none
469475
dotnet_diagnostic.CA1822.severity = suggestion
476+
dotnet_diagnostic.CA1849.severity = error # Call async methods when in an async method
477+
dotnet_diagnostic.CA1854.severity = suggestion # Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
478+
dotnet_diagnostic.CA1855.severity = suggestion # Prefer 'Clear' over 'Fill'
479+
dotnet_diagnostic.CA1856.severity = error # Incorrect usage of ConstantExpected attribute
480+
dotnet_diagnostic.CA1857.severity = suggestion # A constant is expected for the parameter
481+
dotnet_diagnostic.CA1858.severity = suggestion # Use 'StartsWith' instead of 'IndexOf'
482+
dotnet_diagnostic.CA1859.severity = suggestion # Use concrete types when possible for improved performance
483+
dotnet_diagnostic.CA1860.severity = suggestion # Avoid using 'Enumerable.Any()' extension method
484+
dotnet_diagnostic.CA1861.severity = suggestion # Avoid constant arrays as arguments
485+
dotnet_diagnostic.CA1862.severity = error # Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
486+
dotnet_diagnostic.CA1863.severity = suggestion # Use 'CompositeFormat'
487+
dotnet_diagnostic.CA1864.severity = suggestion # Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
488+
dotnet_diagnostic.CA1865.severity = suggestion # Use char overload
489+
dotnet_diagnostic.CA1866.severity = suggestion # Use char overload
490+
dotnet_diagnostic.CA1867.severity = suggestion # Use char overload
491+
dotnet_diagnostic.CA1868.severity = suggestion # Unnecessary call to 'Contains(item)'
492+
dotnet_diagnostic.CA1869.severity = suggestion # Cache and reuse 'JsonSerializerOptions' instances
493+
dotnet_diagnostic.CA1870.severity = suggestion # Use a cached 'SearchValues' instance
470494
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
495+
dotnet_diagnostic.CA2017.severity = error # Parameter count mismatch
496+
dotnet_diagnostic.CA2018.severity = error # The count argument to Buffer.BlockCopy should specify the number of bytes to copy
497+
dotnet_diagnostic.CA2019.severity = error # ThreadStatic fields should not use inline initialization
498+
dotnet_diagnostic.CA2021.severity = error # Don't call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
499+
dotnet_diagnostic.CA2250.severity = suggestion # Use ThrowIfCancellationRequested
500+
dotnet_diagnostic.CA2252.severity = suggestion # Opt-in to preview features should be used with caution
501+
dotnet_diagnostic.CA2253.severity = error # Named placeholders should not be numeric values
502+
dotnet_diagnostic.CA2254.severity = suggestion # Template should be a static expression
503+
dotnet_diagnostic.CA2255.severity = suggestion # The ModuleInitializer attribute should not be used in libraries
504+
dotnet_diagnostic.CA2259.severity = error # Ensure ThreadStatic is only used with static fields
505+
dotnet_diagnostic.CA2260.severity = error # Implement generic math interfaces correctly
506+
dotnet_diagnostic.CA2261.severity = error # Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
471507
dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
472508
dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md
473509

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
<ItemGroup Label="Code Analyzers">
5252
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
5353
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
54-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.162" PrivateAssets="All" />
54+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.169" PrivateAssets="All" />
5555
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
5656
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
57-
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.30.0.95878" PrivateAssets="All" />
57+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" PrivateAssets="All" />
5858
</ItemGroup>
5959

6060
</Project>

test/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
2323
dotnet_diagnostic.MA0004.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
2424
dotnet_diagnostic.MA0016.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
25-
25+
dotnet_diagnostic.MA0051.severity = none # Method Length
2626

2727
# Microsoft - Code Analysis
2828
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/

test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,6 @@
66
<IsTestProject>true</IsTestProject>
77
</PropertyGroup>
88

9-
<ItemGroup>
10-
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
11-
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
14-
<PackageReference Include="xunit" Version="2.9.0" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17-
<PrivateAssets>all</PrivateAssets>
18-
</PackageReference>
19-
<PackageReference Include="coverlet.collector" Version="6.0.2">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
23-
</ItemGroup>
24-
259
<ItemGroup>
2610
<ProjectReference Include="..\..\src\Atc.Hosting\Atc.Hosting.csproj" />
2711
</ItemGroup>

test/Directory.Build.props

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Atc.Test" Version="1.0.89" />
14+
<PackageReference Include="Atc.Test" Version="1.1.2" />
1515
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" PrivateAssets="All" />
16+
<PackageReference Include="coverlet.collector" Version="6.0.2">
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
<PrivateAssets>all</PrivateAssets>
19+
</PackageReference>
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
21+
<PackageReference Include="xunit" Version="2.9.2" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
<PrivateAssets>all</PrivateAssets>
25+
</PackageReference>
1626
</ItemGroup>
1727

1828
<ItemGroup>

0 commit comments

Comments
 (0)