From bda23b57baa2352176b3418f6bb6476435d32678 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 08:57:38 +0100 Subject: [PATCH 1/7] Migrate to new solution format --- Excercism.Analyzers.CSharp.sln | 27 --------------------------- Excercism.Analyzers.CSharp.slnx | 5 +++++ 2 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 Excercism.Analyzers.CSharp.sln create mode 100644 Excercism.Analyzers.CSharp.slnx diff --git a/Excercism.Analyzers.CSharp.sln b/Excercism.Analyzers.CSharp.sln deleted file mode 100644 index d24533a4..00000000 --- a/Excercism.Analyzers.CSharp.sln +++ /dev/null @@ -1,27 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C8244974-AD21-49E6-BFC3-D04A7B9ABC82}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercism.Analyzers.CSharp", "src\Exercism.Analyzers.CSharp\Exercism.Analyzers.CSharp.csproj", "{31AEC9B0-D65C-4294-9C13-84383610B0AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {31AEC9B0-D65C-4294-9C13-84383610B0AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {31AEC9B0-D65C-4294-9C13-84383610B0AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {31AEC9B0-D65C-4294-9C13-84383610B0AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {31AEC9B0-D65C-4294-9C13-84383610B0AE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {31AEC9B0-D65C-4294-9C13-84383610B0AE} = {C8244974-AD21-49E6-BFC3-D04A7B9ABC82} - EndGlobalSection -EndGlobal diff --git a/Excercism.Analyzers.CSharp.slnx b/Excercism.Analyzers.CSharp.slnx new file mode 100644 index 00000000..e9176bbe --- /dev/null +++ b/Excercism.Analyzers.CSharp.slnx @@ -0,0 +1,5 @@ + + + + + From cc89560ff816cb7b6d702f4c4b5766a893e66c49 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 09:05:24 +0100 Subject: [PATCH 2/7] Upgrade .NET 10 Docker image --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d7194939..1a979261 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine3.20-amd64 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build WORKDIR /app # Copy csproj and restore as distinct layer @@ -10,7 +10,7 @@ COPY src/Exercism.Analyzers.CSharp . RUN dotnet publish -r linux-musl-x64 -c Release --self-contained true -o /opt/analyzer # Build runtime image -FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine3.20-amd64 AS runtime +FROM mcr.microsoft.com/dotnet/runtime-deps:10.0.103-alpine3.23 AS runtime WORKDIR /opt/analyzer COPY --from=build /opt/analyzer/ . From 565615dc1c41c54777c81460af698d3b68667ebe Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 15:34:11 +0100 Subject: [PATCH 3/7] Update README instructions --- README.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5ed97a65..304aeefe 100644 --- a/README.md +++ b/README.md @@ -9,25 +9,15 @@ The C# analyzer implements the [analyzer interface][analyzer-interface]. It uses To analyze a solution, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./analyze.ps1 `. This script will run the analyzer on the specified directory. +1. Run `./bin/run.sh `. This script will run the analyzer on the specified directory. 1. Once the script has completed, the analysis results will be written to `/analysis.json`. -## Analyzing multiple solutions - -To analyze multiple solutions at once, follow these steps: - -1. Open a command prompt in the root directory. -1. Run `./bulk-analyze.ps1 `. This script will run the analyzer on each directory sub-directory of ``. -1. Once the script has completed, it will: - 1. Output general staticics to the console. - 1. Write detailed analysis results to `/bulk_analysis.json`. - ## Analyzing a solution using Docker To analyze a solution using a Docker container, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./run-in-docker.ps1 `. This script will: +1. Run `./bin/run-in-docker.sh `. This script will: 1. Build the analyzer Docker image (if necessary). 1. Run the analyzer Docker image (as a container), passing the specified `exercise` and `directory` arguments. 1. Once the script has completed, the analysis result can be found at `/analysis.json`. From 1b86b0052ca959716e898c5653500603bc6c6624 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 15:34:38 +0100 Subject: [PATCH 4/7] Upgrade package and target framework to .NET 10 --- .../Exercism.Analyzers.CSharp.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj b/src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj index 3b2ea86d..396b74d4 100644 --- a/src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj +++ b/src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj @@ -1,13 +1,13 @@ - net9.0 + net10.0 Exe true - + From 033c8feb5d8ae0caa417110574418f83ceb744e3 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 16:26:09 +0100 Subject: [PATCH 5/7] Upgrade dockerfile --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a979261..b1b3fe34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,18 @@ -FROM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build +ARG TARGETARCH + WORKDIR /app # Copy csproj and restore as distinct layer COPY src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj . -RUN dotnet restore -r linux-musl-x64 +RUN dotnet restore -a $TARGETARCH # Copy everything else and build COPY src/Exercism.Analyzers.CSharp . -RUN dotnet publish -r linux-musl-x64 -c Release --self-contained true -o /opt/analyzer +RUN dotnet publish -a $TARGETARCH --no-restore --self-contained true --output /opt/analyzer # Build runtime image -FROM mcr.microsoft.com/dotnet/runtime-deps:10.0.103-alpine3.23 AS runtime +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime-deps:10.0.3-alpine3.23 AS runtime WORKDIR /opt/analyzer COPY --from=build /opt/analyzer/ . From 426ab311f85d4aaad1a2152aa4056c5faf2b505b Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 16:26:15 +0100 Subject: [PATCH 6/7] Inline code --- src/Exercism.Analyzers.CSharp/Program.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Exercism.Analyzers.CSharp/Program.cs b/src/Exercism.Analyzers.CSharp/Program.cs index 951c65e5..e8cbe11d 100644 --- a/src/Exercism.Analyzers.CSharp/Program.cs +++ b/src/Exercism.Analyzers.CSharp/Program.cs @@ -11,11 +11,6 @@ public static async Task Main(string[] args) { var options = new Options(args[0], args[1], args[2]); - await RunAnalysis(options); - } - - private static async Task RunAnalysis(Options options) - { Console.WriteLine($"Analyzing {options.Slug} solution in directory {options.InputDirectory}"); var solution = await Loader.Load(options); From 1fbf70a0faa2b918e5fde474d85fdae9224fcb68 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Mar 2026 19:08:27 +0100 Subject: [PATCH 7/7] Fix expected tags --- tests/yacht/approaches/linq/expected_tags.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/yacht/approaches/linq/expected_tags.json b/tests/yacht/approaches/linq/expected_tags.json index 8586dab1..b64ca5c6 100644 --- a/tests/yacht/approaches/linq/expected_tags.json +++ b/tests/yacht/approaches/linq/expected_tags.json @@ -32,6 +32,10 @@ "technique:boolean-logic", "technique:exceptions", "technique:higher-order-functions", - "technique:short-circuiting" + "technique:immutability", + "technique:memory-management", + "technique:performance", + "technique:short-circuiting", + "uses:Span" ] }