Skip to content

Commit 61d04cc

Browse files
authored
Merge pull request #12 from atc-net/feature/maintenance
Upgrade pipelines and coding-rules
2 parents 1af4361 + 2fa0cb0 commit 61d04cc

File tree

15 files changed

+71
-55
lines changed

15 files changed

+71
-55
lines changed

.editorconfig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2-
# Version: 1.0.9
3-
# Updated: 31-03-2023
2+
# Version: 1.0.0
3+
# Updated: 25-09-2023
44
# Location: Root
5-
# Distribution: DotNet7
5+
# Distribution: DotNet8
66
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
77

88
##########################################
@@ -201,8 +201,8 @@ csharp_style_unused_value_assignment_preference = discard_variable
201201

202202
# Index and range preferences
203203
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
204-
csharp_style_prefer_index_operator = true # IDE0056
205-
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
206206

207207
# Miscellaneous preferences
208208
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
@@ -450,18 +450,23 @@ dotnet_naming_rule.parameters_rule.severity = warning
450450
dotnet_diagnostic.MA0003.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0003.md
451451
dotnet_diagnostic.MA0004.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
452452
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
453454
dotnet_diagnostic.MA0016.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
454455
dotnet_diagnostic.MA0025.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0025.md
455456
dotnet_diagnostic.MA0026.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0026.md
456457
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
457459
dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0048.md
458460

459461

460462
# Microsoft - Code Analysis
461463
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
462464
dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
463465
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
464467
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
465470
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
466471
dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
467472
dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md
@@ -488,6 +493,7 @@ dotnet_diagnostic.SA1202.severity = none # https://github.com/atc-net
488493
dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
489494
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
490495
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
491497
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
492498
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
493499
dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
@@ -499,6 +505,10 @@ dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net
499505
# SonarAnalyzer.CSharp
500506
# https://rules.sonarsource.com/csharp
501507
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"
502512

503513

504514
##########################################
@@ -514,10 +524,10 @@ dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net
514524
dotnet_diagnostic.SA1615.severity = none # Element return value should be documented
515525

516526
dotnet_diagnostic.CA1056.severity = none # URI properties should not be strings
517-
dotnet_diagnostic.CA1812.severity = none # Internal class that is apparently never instantiated.
518527
dotnet_diagnostic.CA2007.severity = none # Consider calling ConfigureAwait on the awaited task
519528
dotnet_diagnostic.CA2227.severity = none # Collection properties should be read only
520529

521530
dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait(false) as the current SynchronizationContext is not needed
522531

523532
dotnet_diagnostic.S1172.severity = suggestion # Temporary, due to false positive in latest version of the analyzer package
533+
dotnet_diagnostic.S6672.severity = suggestion # Intended the logger is generic

.github/workflows/post-integration.yml

Lines changed: 4 additions & 4 deletions
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 7.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: '7.0.x'
36+
dotnet-version: '8.0.x'
3737

3838
- name: ⚙️ Set up JDK 17
3939
uses: actions/setup-java@v3

.github/workflows/pre-integration.yml

Lines changed: 8 additions & 8 deletions
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 7.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: '7.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
- dotnet-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 7.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: '7.0.x'
49+
dotnet-version: '8.0.x'
5050

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

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
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 7.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: '7.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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
<PropertyGroup Label="Compile settings">
1818
<Nullable>enable</Nullable>
19-
<LangVersion>11.0</LangVersion>
19+
<LangVersion>12.0</LangVersion>
2020
<ImplicitUsings>enable</ImplicitUsings>
21-
<TargetFramework>net7.0</TargetFramework>
21+
<TargetFramework>net8.0</TargetFramework>
2222
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2323
<NoWarn>1573,1591,1712,CA1014,NU5104</NoWarn>
2424

@@ -43,10 +43,10 @@
4343
<ItemGroup Label="Code Analyzers">
4444
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
4545
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
46-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.33" PrivateAssets="All" />
46+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.146" PrivateAssets="All" />
4747
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
4848
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
49-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544" PrivateAssets="All" />
49+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.23.1.88495" PrivateAssets="All" />
5050
</ItemGroup>
5151

5252
</Project>

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The Atc.Hosting namespace serves as a toolbox for building scalable and reliable
2323
- [Constructor dependency injection](#constructor-dependency-injection)
2424
- [In your `StartAsync` and `StopAsync` methods, update the service's running state](#in-your-startasync-and-stopasync-methods-update-the-services-running-state)
2525
- [Inside your worker method, you can set the running state of the service (to update latest timestamp)](#inside-your-worker-method-you-can-set-the-running-state-of-the-service-to-update-latest-timestamp)
26+
- [Default implementation for `BackgroundServiceBase<>`](#default-implementation-for-backgroundservicebase)
2627
- [Complete TimeFileWorker example](#complete-timefileworker-example)
2728
- [Extensions for ServiceProvider](#extensions-for-serviceprovider)
2829
- [Using GetHostedService`<T>`](#using-gethostedservicet)
@@ -185,8 +186,8 @@ The `BackgroundServiceBase<>` automatically uses the `IBackgroundServiceHealthSe
185186
public TimeFileWorker(
186187
//...other parameters
187188
IBackgroundServiceHealthService healthService,
188-
//...other parameters
189-
)
189+
//...other parameters
190+
)
190191
: base (healthService)
191192
{
192193
//...other initializations
@@ -313,7 +314,7 @@ public void DefineEndpoints(WebApplication app)
313314

314315
# Requirements
315316

316-
- [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
317+
- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
317318

318319
# How to contribute
319320

atc-coding-rules-updater.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2-
"projectTarget": "DotNet7",
2+
"projectTarget": "DotNet8",
3+
"useLatestMinorNugetVersion": true,
4+
"useTemporarySuppressions": false,
5+
"temporarySuppressionAsExcel": false,
6+
"analyzerProviderCollectingMode": "LocalCache",
37
"mappings": {
48
"src": {
59
"paths": [

atc-coding-rules-updater.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ atc-coding-rules-updater `
99
run `
1010
-p $currentPath `
1111
--optionsPath $currentPath'\atc-coding-rules-updater.json' `
12-
-v
12+
--verbose

sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Worker">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
9+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

src/.editorconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
2-
# Version: 1.0.9
3-
# Updated: 31-03-2023
2+
# Version: 1.0.0
3+
# Updated: 25-09-2023
44
# Location: src
5-
# Distribution: DotNet7
5+
# Distribution: DotNet8
66
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
77

88
##########################################
@@ -48,4 +48,4 @@
4848

4949
dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists
5050

51-
dotnet_diagnostic.MA0016.severity = none # Prefer returning collection abstraction instead of implementation
51+
dotnet_diagnostic.MA0016.severity = none # Prefer returning collection abstraction instead of implementation

0 commit comments

Comments
 (0)