Skip to content

Change "description" key layout in gitlab output format #19881

@ppiasek

Description

@ppiasek

Hey! We are using Ruff in our project and have integrated it with Gitlab's codequality reports. Apart from that, we are using a few other tools using the same reports, and we have noticed that we struggle to find what kind of check is reported by Ruff in codequality report, because only the description is displayed there.

Example:
Major - Missing docstring in public package in <file>

This might be obvious for someone, but we are in the process of setting up a new repo and polishing rule configuration - removing rules that we do not like (we started from enabling all the possible rules). I noticed that pylint, on the other hand, displays it much better.

Example:
Critical - E1120: No value for argument 'url' in function call in <file>

The description from pylint contains the actual check name.

How does it look from the code?

Right now, Ruff has it implemented like this:

let value = json!({
                "check_name": check_name,
                "description": description,
                "severity": "major",
                "fingerprint": format!("{:x}", message_fingerprint),
                "location": {
                    "path": path,
                    "positions": {
                        "begin": start_location,
                        "end": end_location,
                    },
                },
            });

How I would imagine it:

let value = json!({
                "check_name": check_name,
                "description": check_name + " " + description, # sorry for the syntax, don't know Rust at all
                "severity": "major",
                "fingerprint": format!("{:x}", message_fingerprint),
                "location": {
                    "path": path,
                    "positions": {
                        "begin": start_location,
                        "end": end_location,
                    },
                },
            });

Optionally there could be a setting whether to display check_name + description or just description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions