MSBuild logger that outputs GitLab Code Quality report format
$ dotnet add package GitlabCodeQualityBuildLogger
An MSBuild logger that outputs build warnings and errors in GitLab Code Quality report format.
dotnet buildcriticalmajormajorminorinfominordotnet new tool-manifest # if you don't have a tool manifest yet
dotnet tool install GitlabCodeQualityBuildLogger.Tool
dotnet tool install -g GitlabCodeQualityBuildLogger.Tool
dotnet build -logger:"$(dotnet tool run gitlab-code-quality-logger);gl-code-quality-report.json"
dotnet build -logger:"$(gitlab-code-quality-logger);gl-code-quality-report.json"
build:
stage: build
script:
- dotnet tool restore
- dotnet build -logger:"$(gitlab-code-quality-logger -o gl-code-quality-report.json)"
artifacts:
reports:
codequality: gl-code-quality-report.json
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
}
}
}
]
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.
I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:
To get started please read the Contribution Guidelines.
dotnet build
dotnet test
src/
├── DotNet.GitlabCodeQualityBuildLogger/ # Core logger library (netstandard2.1)
└── DotNet.GitlabCodeQualityBuildLogger.Tool/ # CLI tool wrapper (net9.0)
tests/
└── DotNet.GitlabCodeQualityBuildLogger.Tests/ # xUnit tests