HUB
Sign inSign up

qualor/scanner-dotnet

By qualor

•Updated about 13 hours ago

Code quality scanner for C#: qualor/scanner plus the .NET 8 and 10 SDKs and Roslynator

Image
Security
Integration & delivery
Developer tools
0

6.9K

qualor/scanner-dotnet repository overview

⁠qualor/scanner-dotnet

Short description: Code quality scanner for C#: qualor/scanner plus .NET 8/10, Roslynator and SonarAnalyzer.CSharp

Categories: Developer tools, Integration & delivery, Security

⁠Overview

The C# scanner of Qualor⁠, the open-source, self-hosted SonarQube alternative with no lines-of-code licence. This image is qualor/scanner⁠ with the tooling for C# projects added. Everything the scanner image does, this one does too; use it for repositories with C# code, and the smaller qualor/scanner for the rest.

⁠Tags

The same tags as qualor/scanner: the full version, such as 0.17.0, and the minor tag, such as 0.17. There is no latest tag.

⁠What it adds to qualor/scanner

Everything in qualor/scanner stays, the Go analyzers (staticcheck, go vet and gosec) and cppcheck for C and C++ included.

  • The .NET SDKs 8.0.427 and 10.0.403, in /opt/qualor/share/dotnet (DOTNET_ROOT), with the .NET CLI telemetry turned off (DOTNET_CLI_TELEMETRY_OPTOUT=1).
  • The Roslynator analyzers 5.0.0, bundled in /opt/qualor/dotnet/analyzers (QUALOR_DOTNET_ANALYZERS).
  • SonarAnalyzer.CSharp 9.32 (SonarQube-compatible rules, roslyn:S####), bundled next to Roslynator. A project's own reference to SonarAnalyzer.CSharp replaces the bundled one, so there is never a duplicate-analyzer error.
  • From Qualor 0.9.0: Qualor's Roslyn taint engine for the C# security rules, run by qualor dotnet end on the rules release when it includes the engine (it needs the .NET SDK, so it runs only in this image).
  • Runs as the user node (uid 1000), like the scanner; about 4.4 GB (about 1.7 GB more than qualor/scanner). It is built from the qualor/scanner image of the same tag, and released with that tag right after it.
⁠How to use it

Roslyn analyzers need the compiler's semantic model, so Qualor hooks into your own build instead of building anything itself:

qualor dotnet begin                 # installs an MSBuild hook for this checkout
dotnet build --no-incremental       # your build: its SDK, restore, feeds and arguments
qualor dotnet end                   # removes the hook, reads the Roslyn logs, runs qualor scan

GitLab CI, with the component from the GitLab CI/CD catalog:

include:
  - component: gitlab.com/qualor/qualor/[email protected]
    inputs:
      image: qualor/scanner-dotnet
      image-tag: '0.17'
      dotnet: true
      build-command: dotnet build MySolution.sln --no-incremental

Or in a job of your own:

qualor:
  image: { name: qualor/scanner-dotnet:0.17, entrypoint: [''] }
  variables: { GIT_DEPTH: 0 }
  script:
    - qualor dotnet begin
    - dotnet build MySolution.sln --no-incremental
    - qualor dotnet end
  after_script:
    - if [ -d .qualor/dotnet ]; then qualor dotnet abort; fi

Azure Pipelines: copy integrations/azure-devops/qualor-dotnet-docker.yml⁠ to azure-pipelines.yml. It runs this image with docker run and needs no extension (https://qualor.dev/docs/azure-devops⁠).

--no-incremental matters: a project that is not recompiled writes no log. The environment variables and exit codes are those of qualor/scanner. The full guide is at https://qualor.dev/docs/languages-and-analyzers⁠.

⁠Licences

The Qualor CLI is MIT-licensed. The .NET SDK is MIT-licensed, and Roslynator is Apache-2.0. SonarAnalyzer.CSharp 9.32 is LGPL-3.0, the last release before the SONAR Source-Available License. This image has no sources image of its own: the complete corresponding source of the copyleft components it carries, SonarAnalyzer.CSharp included, is qualor/scanner-sources⁠ with the same tag, the same one qualor/scanner uses. The notices are in /opt/qualor/NOTICE.md and the licence texts in /opt/qualor/licenses/.

⁠Trademarks

SonarQube and SonarCloud are trademarks of SonarSource SA. Qualor is an independent project and is not affiliated with, sponsored or endorsed by SonarSource. Their names are used only to describe compatibility and to compare features.

Tag summary
Recent tags
Content type
Image
Digest
sha256:8f7721ddf…
Size
1.1 GB
Last updated
about 13 hours ago
docker pull qualor/scanner-dotnet:0.18