Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/ .
Expand Down
27 changes: 0 additions & 27 deletions Excercism.Analyzers.CSharp.sln

This file was deleted.

5 changes: 5 additions & 0 deletions Excercism.Analyzers.CSharp.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj" />
</Folder>
</Solution>
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <exercise> <directory>`. This script will run the analyzer on the specified directory.
1. Run `./bin/run.sh <exercise> <directory>`. This script will run the analyzer on the specified directory.
1. Once the script has completed, the analysis results will be written to `<directory>/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 <exercise> <directory>`. This script will run the analyzer on each directory sub-directory of `<directory>`.
1. Once the script has completed, it will:
1. Output general staticics to the console.
1. Write detailed analysis results to `<directory>/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 <exercise> <directory>`. This script will:
1. Run `./bin/run-in-docker.sh <exercise> <directory>`. 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 `<directory>/analysis.json`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions src/Exercism.Analyzers.CSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion tests/yacht/approaches/linq/expected_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>"
]
}