diff --git a/.github/workflows/codebreaker-lib-analyzers-stable.yml b/.github/workflows/codebreaker-lib-analyzers-stable.yml index 79427020..e5024aa5 100644 --- a/.github/workflows/codebreaker-lib-analyzers-stable.yml +++ b/.github/workflows/codebreaker-lib-analyzers-stable.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build the library run: dotnet build -c Release ${{ env.solutionfile-path }} diff --git a/.github/workflows/codebreaker-lib-analyzers.yml b/.github/workflows/codebreaker-lib-analyzers.yml index 234867f6..c90aca9b 100644 --- a/.github/workflows/codebreaker-lib-analyzers.yml +++ b/.github/workflows/codebreaker-lib-analyzers.yml @@ -27,7 +27,7 @@ jobs: version-offset: 38 solutionfile-path: src/Codebreaker.Analyzers.sln projectfile-path: src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj - dotnet-version: '8.0.x' + dotnet-version: '9.0.x' artifact-name: codebreaker-analyzers branch-name: main @@ -38,6 +38,8 @@ jobs: artifact-name: codebreaker-analyzers secrets: inherit + # NuGet publish is now done with codebreaker-lib-stable.yml + # In case a preview version will be published again to NuGet, this can be uncommented. # publishnuget: # uses: CodebreakerApp/Codebreaker.Backend/.github/workflows/publishnuget-nugetserver.yml@main # needs: publishdevops diff --git a/src/services/common/Codebreaker.GameAPIs.Analyzers.Tests/Codebreaker.GameAPIs.Analyzers.Tests.csproj b/src/services/common/Codebreaker.GameAPIs.Analyzers.Tests/Codebreaker.GameAPIs.Analyzers.Tests.csproj index b78889d8..ef967361 100644 --- a/src/services/common/Codebreaker.GameAPIs.Analyzers.Tests/Codebreaker.GameAPIs.Analyzers.Tests.csproj +++ b/src/services/common/Codebreaker.GameAPIs.Analyzers.Tests/Codebreaker.GameAPIs.Analyzers.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable @@ -10,15 +10,15 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/services/common/Codebreaker.GameAPIs.Analyzers/Analyzers/GameGuessAnalyzer.cs b/src/services/common/Codebreaker.GameAPIs.Analyzers/Analyzers/GameGuessAnalyzer.cs index 2fab97bd..b51bbb51 100644 --- a/src/services/common/Codebreaker.GameAPIs.Analyzers/Analyzers/GameGuessAnalyzer.cs +++ b/src/services/common/Codebreaker.GameAPIs.Analyzers/Analyzers/GameGuessAnalyzer.cs @@ -8,7 +8,7 @@ public abstract class GameGuessAnalyzer(IGame game, TField[] guesses, int moveNumber) : IGameGuessAnalyzer where TResult : struct { - protected readonly IGame _game = game; + private protected readonly IGame _game = game; private readonly int _moveNumber = moveNumber; protected TField[] Guesses { get; private set; } = guesses; @@ -32,7 +32,9 @@ private void ValidateGuess() { /// The number of codes in the game does not match the number of pegs in the move. if (_game.NumberCodes != Guesses.Length) + { throw new ArgumentException($"Invalid guess number {Guesses.Length} for {_game.NumberCodes} code numbers") { HResult = 4200 }; + } ValidateGuessValues(); diff --git a/src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj b/src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj index 0a4806ab..a2609a6e 100644 --- a/src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj +++ b/src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj @@ -2,10 +2,10 @@ CNinnovation.Codebreaker.Analyzers - net7.0;net8.0 + net8.0;net9.0 enable enable - latest + 13.0 Codebreaker;CNinnovation;GameAnalyzers @@ -15,10 +15,7 @@ readme.md codebreaker.jpeg - - - - true + true diff --git a/src/services/common/Codebreaker.GameAPIs.Analyzers/Fields/ShapeAndColorField.cs b/src/services/common/Codebreaker.GameAPIs.Analyzers/Fields/ShapeAndColorField.cs index d1901c51..1a2bd098 100644 --- a/src/services/common/Codebreaker.GameAPIs.Analyzers/Fields/ShapeAndColorField.cs +++ b/src/services/common/Codebreaker.GameAPIs.Analyzers/Fields/ShapeAndColorField.cs @@ -2,7 +2,7 @@ public partial record class ShapeAndColorField(string Shape, string Color) { - internal static ShapeAndColorField Empty => new ShapeAndColorField(string.Empty, string.Empty); + internal static ShapeAndColorField Empty => new(string.Empty, string.Empty); private const char Separator = ';'; public override string ToString() => $"{Shape}{Separator}{Color}"; diff --git a/src/services/common/Codebreaker.GameAPIs.Analyzers/Results/SimpleColorResult_ISpanParsable.cs b/src/services/common/Codebreaker.GameAPIs.Analyzers/Results/SimpleColorResult_ISpanParsable.cs index 1f3a8686..6eb8de12 100644 --- a/src/services/common/Codebreaker.GameAPIs.Analyzers/Results/SimpleColorResult_ISpanParsable.cs +++ b/src/services/common/Codebreaker.GameAPIs.Analyzers/Results/SimpleColorResult_ISpanParsable.cs @@ -36,7 +36,7 @@ public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [Ma values[i] = (ResultValue)(s[j] - '0'); } result = new SimpleColorResult(values); - return s != default; + return !s.IsEmpty; } public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out SimpleColorResult result) =>