From 70a5079e03a73c317ce17c6309c4f1bd55e94688 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:01:59 +0200 Subject: [PATCH 1/8] fix: set proper cli parameter for verbose after spectre console update --- atc-coding-rules-updater.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atc-coding-rules-updater.ps1 b/atc-coding-rules-updater.ps1 index df1a648..3d555a8 100644 --- a/atc-coding-rules-updater.ps1 +++ b/atc-coding-rules-updater.ps1 @@ -9,4 +9,4 @@ atc-coding-rules-updater ` run ` -p $currentPath ` --optionsPath $currentPath'\atc-coding-rules-updater.json' ` - -v \ No newline at end of file + --verbose \ No newline at end of file From bff52fa15ca8c71df76f2253b739b29b4cbe527f Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:02:17 +0200 Subject: [PATCH 2/8] feat: update atc-coding-rules-updater configuration to dotnet8 --- atc-coding-rules-updater.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/atc-coding-rules-updater.json b/atc-coding-rules-updater.json index c689e1d..65e3cb3 100644 --- a/atc-coding-rules-updater.json +++ b/atc-coding-rules-updater.json @@ -1,5 +1,9 @@ { - "projectTarget": "DotNet7", + "projectTarget": "DotNet8", + "useLatestMinorNugetVersion": true, + "useTemporarySuppressions": false, + "temporarySuppressionAsExcel": false, + "analyzerProviderCollectingMode": "LocalCache", "mappings": { "src": { "paths": [ From f08f1b29601e6026d19358b3518f1e101005d9df Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:02:31 +0200 Subject: [PATCH 3/8] docs: update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a60a208..46c92b8 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ The Atc.Hosting namespace serves as a toolbox for building scalable and reliable - [Constructor dependency injection](#constructor-dependency-injection) - [In your `StartAsync` and `StopAsync` methods, update the service's running state](#in-your-startasync-and-stopasync-methods-update-the-services-running-state) - [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) + - [Default implementation for `BackgroundServiceBase<>`](#default-implementation-for-backgroundservicebase) - [Complete TimeFileWorker example](#complete-timefileworker-example) - [Extensions for ServiceProvider](#extensions-for-serviceprovider) - [Using GetHostedService``](#using-gethostedservicet) @@ -185,8 +186,8 @@ The `BackgroundServiceBase<>` automatically uses the `IBackgroundServiceHealthSe public TimeFileWorker( //...other parameters IBackgroundServiceHealthService healthService, - //...other parameters - ) + //...other parameters + ) : base (healthService) { //...other initializations @@ -313,7 +314,7 @@ public void DefineEndpoints(WebApplication app) # Requirements -- [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) +- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) # How to contribute From 57209cb708bc70014a9290d19182a1c1569f6a46 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:03:03 +0200 Subject: [PATCH 4/8] feat: update LangVersion and TargetFramework in root Directory.Build.props --- Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index bdf6c16..3f26a8c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,9 +16,9 @@ enable - 11.0 + 12.0 enable - net7.0 + net8.0 true 1573,1591,1712,CA1014,NU5104 From 9517388fc1349ef4fcc6a806ecc6ceca2dfa22ff Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:03:22 +0200 Subject: [PATCH 5/8] chore: update coding-rules --- .editorconfig | 22 ++++++++++++++++------ src/.editorconfig | 8 ++++---- test/.editorconfig | 7 ++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5784c47..8f55f33 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,8 @@ # ATC coding rules - https://github.com/atc-net/atc-coding-rules -# Version: 1.0.9 -# Updated: 31-03-2023 +# Version: 1.0.0 +# Updated: 25-09-2023 # Location: Root -# Distribution: DotNet7 +# Distribution: DotNet8 # Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options ########################################## @@ -201,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 @@ -450,10 +450,12 @@ dotnet_naming_rule.parameters_rule.severity = warning 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 @@ -461,7 +463,10 @@ dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net # 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 @@ -488,6 +493,7 @@ dotnet_diagnostic.SA1202.severity = none # https://github.com/atc-net 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 @@ -499,6 +505,10 @@ dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net # 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" ########################################## @@ -514,10 +524,10 @@ dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net dotnet_diagnostic.SA1615.severity = none # Element return value should be documented dotnet_diagnostic.CA1056.severity = none # URI properties should not be strings -dotnet_diagnostic.CA1812.severity = none # Internal class that is apparently never instantiated. dotnet_diagnostic.CA2007.severity = none # Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.CA2227.severity = none # Collection properties should be read only dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait(false) as the current SynchronizationContext is not needed dotnet_diagnostic.S1172.severity = suggestion # Temporary, due to false positive in latest version of the analyzer package +dotnet_diagnostic.S6672.severity = suggestion # Intended the logger is generic \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig index 149c9bb..9cded84 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -1,8 +1,8 @@ # ATC coding rules - https://github.com/atc-net/atc-coding-rules -# Version: 1.0.9 -# Updated: 31-03-2023 +# Version: 1.0.0 +# Updated: 25-09-2023 # Location: src -# Distribution: DotNet7 +# Distribution: DotNet8 # Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options ########################################## @@ -48,4 +48,4 @@ dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists -dotnet_diagnostic.MA0016.severity = none # Prefer returning collection abstraction instead of implementation +dotnet_diagnostic.MA0016.severity = none # Prefer returning collection abstraction instead of implementation \ No newline at end of file diff --git a/test/.editorconfig b/test/.editorconfig index 1a2618c..7d37978 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -1,8 +1,8 @@ # ATC coding rules - https://github.com/atc-net/atc-coding-rules -# Version: 1.0.9 -# Updated: 31-03-2023 +# Version: 1.0.0 +# Updated: 25-09-2023 # Location: test -# Distribution: DotNet7 +# Distribution: DotNet8 # Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options ########################################## @@ -27,6 +27,7 @@ dotnet_diagnostic.MA0016.severity = none # https://github.com/atc-net # Microsoft - Code Analysis # https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ dotnet_diagnostic.CA1068.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md +dotnet_diagnostic.CA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1602.md dotnet_diagnostic.CA1707.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md dotnet_diagnostic.CA2007.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md From 550a12b84e37156be59c9421e666ce648d1a0ccd Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:03:53 +0200 Subject: [PATCH 6/8] chore: update nuget packages and analyzers --- Directory.Build.props | 4 ++-- .../Atc.Hosting.TimeFile.Sample.csproj | 2 +- src/Atc.Hosting/Atc.Hosting.csproj | 6 +++--- src/Directory.Build.props | 4 ++-- test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj | 14 +++++++------- test/Directory.Build.props | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3f26a8c..4b3b3dc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -43,10 +43,10 @@ - + - + \ No newline at end of file diff --git a/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj b/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj index 8b9df1b..a63da76 100644 --- a/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj +++ b/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Atc.Hosting/Atc.Hosting.csproj b/src/Atc.Hosting/Atc.Hosting.csproj index 1249423..5d24292 100644 --- a/src/Atc.Hosting/Atc.Hosting.csproj +++ b/src/Atc.Hosting/Atc.Hosting.csproj @@ -14,9 +14,9 @@ - - - + + + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d65000e..f516744 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -53,8 +53,8 @@ - - + + diff --git a/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj b/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj index 0977be0..7575344 100644 --- a/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj +++ b/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj @@ -7,16 +7,16 @@ - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 8f1a85e..586e8e3 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -11,8 +11,8 @@ - - + + From ee511dc01ab1407cef5fcd36fb1a742af3eb8a5e Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:04:06 +0200 Subject: [PATCH 7/8] feat: update sample and test projects to Dotnet8 --- .../Atc.Hosting.TimeFile.Sample.csproj | 2 +- test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj b/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj index a63da76..f824b59 100644 --- a/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj +++ b/sample/Atc.Hosting.TimeFile.Sample/Atc.Hosting.TimeFile.Sample.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false diff --git a/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj b/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj index 7575344..fc92af1 100644 --- a/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj +++ b/test/Atc.Hosting.Tests/Atc.Hosting.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false true From 2fa0cb02056470548331a520456ce5e995347692 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Tue, 9 Apr 2024 11:04:35 +0200 Subject: [PATCH 8/8] ci: update github actions to latest versions and dotnet 8 --- .github/workflows/post-integration.yml | 8 ++++---- .github/workflows/pre-integration.yml | 16 ++++++++-------- .github/workflows/release.yml | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/post-integration.yml b/.github/workflows/post-integration.yml index cead8ca..45e5168 100644 --- a/.github/workflows/post-integration.yml +++ b/.github/workflows/post-integration.yml @@ -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 7.0.x - uses: actions/setup-dotnet@v1 + - name: โš™๏ธ Setup dotnet 8.0.x + uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: โš™๏ธ Set up JDK 17 uses: actions/setup-java@v3 diff --git a/.github/workflows/pre-integration.yml b/.github/workflows/pre-integration.yml index f598991..2536549 100644 --- a/.github/workflows/pre-integration.yml +++ b/.github/workflows/pre-integration.yml @@ -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 7.0.x - uses: actions/setup-dotnet@v1 + - name: โš™๏ธ Setup dotnet 8.0.x + uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: ๐Ÿงน Clean run: dotnet clean -c Release && dotnet nuget locals all --clear @@ -39,14 +39,14 @@ jobs: - dotnet-build steps: - name: ๐Ÿ›’ Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: โš™๏ธ Setup dotnet 7.0.x - uses: actions/setup-dotnet@v1 + - name: โš™๏ธ Setup dotnet 8.0.x + uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: ๐Ÿ” Restore packages run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4621f2..0924fc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 7.0.x - uses: actions/setup-dotnet@v1 + - name: โš™๏ธ Setup dotnet 8.0.x + uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: ๐Ÿงน Clean run: dotnet clean -c Release && dotnet nuget locals all --clear