GitlabCodeQualityBuildLogger.Tool
1.0.8
See the version list below for details.
dotnet tool install --global GitlabCodeQualityBuildLogger.Tool --version 1.0.8
dotnet new tool-manifest
dotnet tool install --local GitlabCodeQualityBuildLogger.Tool --version 1.0.8
#tool dotnet:?package=GitlabCodeQualityBuildLogger.Tool&version=1.0.8
nuke :add-package GitlabCodeQualityBuildLogger.Tool --version 1.0.8
DotNet.GitlabCodeQualityBuildLogger
<p align="center"> <img width="1024" src="./.github/images/banner.png"> <br /> An MSBuild logger that outputs build warnings and errors in <a href="https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool">GitLab Code Quality report format</a>. </p>
Features
- Captures build errors and warnings during
dotnet build - Outputs JSON in GitLab Code Quality format
- Automatic severity mapping:
- Build errors →
critical - CS* (compiler warnings) →
major - CA2*/CA5* (security rules) →
major - CA* (other code analysis) →
minor - IDE*/SA* (style suggestions) →
info - Other warnings →
minor
- Build errors →
- Generates stable fingerprints for issue tracking
Requirements
- .NET SDK 6.0 or later (for running the tool)
- MSBuild-based project
Installation
Project-level (recommended)
dotnet new tool-manifest # if you don't have a tool manifest yet
dotnet tool install GitlabCodeQualityBuildLogger.Tool
Global
dotnet tool install -g GitlabCodeQualityBuildLogger.Tool
Usage
Global
dotnet build -logger:"$(dotnet tool run gitlab-code-quality-logger);gl-code-quality-report.json"
Global
dotnet build -logger:"$(gitlab-code-quality-logger);gl-code-quality-report.json"
GitLab CI Example
build:
stage: build
script:
- dotnet tool restore
- dotnet build -logger:"$(gitlab-code-quality-logger);gl-code-quality-report.json"
artifacts:
reports:
codequality: gl-code-quality-report.json
Output Format
The logger produces JSON compatible with GitLab's Code Quality report format:
[
{
"description": "CS0168: The variable 'x' is declared but never used",
"check_name": "CS0168",
"fingerprint": "A1B2C3D4E5F6...",
"severity": "major",
"location": {
"path": "src/MyClass.cs",
"lines": {
"begin": 42
}
}
}
]
Motivation
GitLab's Code Quality feature provides a great way to track code issues directly in merge requests. However, there was no simple way to integrate .NET build warnings and errors into this workflow. This logger bridges that gap by converting MSBuild output into GitLab's expected format.
Contributing
I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the configuration
- Submitting a fix
- Proposing new features
- Becoming a maintainer
To get started please read the Contribution Guidelines.
Development
Requirements
Build
dotnet build
Test
dotnet test
Project Structure
src/
├── DotNet.GitlabCodeQualityBuildLogger/ # Core logger library (netstandard2.1)
└── DotNet.GitlabCodeQualityBuildLogger.Tool/ # CLI tool wrapper (net9.0)
tests/
└── DotNet.GitlabCodeQualityBuildLogger.Tests/ # xUnit tests
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.