diff --git a/Dockerfile b/Dockerfile index d7194939..b1b3fe34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,18 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine3.20-amd64 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:9.0-alpine3.20-amd64 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/ . 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 @@ + + + + + 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`. 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 - + 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); 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" ] }