https://github.com/exercism/csharp-analyzer
An analyser for C#
https://github.com/exercism/csharp-analyzer
community-contributions-paused exercism-analyzer exercism-tooling maintained-autonomous
Last synced: 25 days ago
JSON representation
An analyser for C#
- Host: GitHub
- URL: https://github.com/exercism/csharp-analyzer
- Owner: exercism
- License: mit
- Created: 2019-03-11T18:31:52.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-01T07:31:29.000Z (3 months ago)
- Last Synced: 2025-04-29T07:31:45.639Z (about 1 month ago)
- Topics: community-contributions-paused, exercism-analyzer, exercism-tooling, maintained-autonomous
- Language: C#
- Size: 18 MB
- Stars: 16
- Watchers: 9
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Exercism C# analyzer
An [analyzer][analyzer-introduction] can automatically detect issues with submissions and comment on them.
The C# analyzer implements the [analyzer interface][analyzer-interface]. It uses [Roslyn][roslyn] to parse the submission's source code into syntax trees, which are then analyzed for known patterns.
## Analyzing a solution
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. 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. 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`.Note that the Docker image is built using the [.NET IL Linker](https://github.com/dotnet/core/blob/master/samples/linker-instructions.md#using-the-net-il-linker), which is why building can be quite slow.
## Source code formatting
This repository uses the [dotnet-format tool](https://github.com/dotnet/format/) to format the source code. There are no custom rules; we just use the default formatting. You can format the code by running the `./format.ps1` command.
### Scripts
The scripts in this repository are written in PowerShell. As PowerShell is cross-platform nowadays, you can also install it on [Linux](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6) and [macOS](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-6).
[analyzer-introduction]: https://github.com/exercism/docs/blob/main/building/tooling/analyzers/README.md
[analyzer-interface]: https://github.com/exercism/docs/blob/main/building/tooling/analyzers/interface.md
[roslyn]: https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/