Skip to content

Include column numbers in GitLab output format.#19708

Merged
MichaReiser merged 1 commit intoastral-sh:mainfrom
cristian64:gitlab_format_column_numbers
Aug 3, 2025
Merged

Include column numbers in GitLab output format.#19708
MichaReiser merged 1 commit intoastral-sh:mainfrom
cristian64:gitlab_format_column_numbers

Conversation

@cristian64
Copy link
Contributor

@cristian64 cristian64 commented Aug 2, 2025

Summary

The CodeClimate report format, which GitLab adopted in a reduced form, supports two ways for specifying diagnostic error locations:

{
  "path": "path/to/file.css",
  "lines": {
    "begin": 13,
    "end": 14
  }
}
{
  "path": "path/to/file.css",
  "positions": {
    "begin": {
      "line": 3,
      "column": 10
    },
    "end": {
      "line": 4,
      "column": 12
    }
  }
}

The second form is richer, as it can include column numbers, which Ruff happens to be able to provide. Ruff will now use the second form.

More details on the specification in https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#locations.

GitLab supports both forms; see https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format.

Test Plan

Change is covered by unit tests; snapshots have been updated.

@cristian64 cristian64 force-pushed the gitlab_format_column_numbers branch 2 times, most recently from 579d6e2 to b4c004c Compare August 2, 2025 23:04
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I've a few nit comments but that overall looks good

@MichaReiser MichaReiser added the diagnostics Related to reporting of diagnostics. label Aug 3, 2025
## Summary

The CodeClimate report format, which GitLab adopted in a reduced form,
supports two ways for specifying diagnostic error locations:

```json
{
  "path": "path/to/file.css",
  "lines": {
    "begin": 13,
    "end": 14
  }
}
```

```json
{
  "path": "path/to/file.css",
  "positions": {
    "begin": {
      "line": 3,
      "column": 10
    },
    "end": {
      "line": 4,
      "column": 12
    }
  }
}
```

The second form is richer, as it can include column numbers, which Ruff
happens to be able to provide. Ruff will now use the second form.

More details on the specification in https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#locations.

GitLab supports both forms; see https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format.

## Test Plan

Change is covered by unit tests; snapshots have been updated.
@cristian64 cristian64 force-pushed the gitlab_format_column_numbers branch from b4c004c to 0116421 Compare August 3, 2025 09:13
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@MichaReiser MichaReiser enabled auto-merge (squash) August 3, 2025 12:33
@MichaReiser MichaReiser merged commit bc6e105 into astral-sh:main Aug 3, 2025
34 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants