Skip to content

linter: gitlab format should output repo-relative paths #17999

@ashsearle

Description

@ashsearle

What version of Oxlint are you using?

1.39.0

What command did you run?

oxlint --format gitlab

What does your .oxlintrc.json config file look like?

No .oxlintrc.json.

What happened?

The location.path in gitlab formatted output should be relative to the closest git repo root, not the CWD (see docs).

The file containing the code quality violation, expressed as a relative path in the repository. Do not prefix with ./.

Steps to reproduce:

# Create temp folder and git repo:
cd $(mktemp -d)
git init .

# Create subfolder and install oxlint:
mkdir pathFromRepoRoot && cd pathFromRepoRoot
yarn add -DE oxlint

# Create and lint example file:
echo "const unused = 2;" > example.js
yarn oxlint --format gitlab

Actual output:

[
  {
    "description": "Variable 'unused' is declared but never used. Unused variables should start with a '_'.",
    "check_name": "eslint(no-unused-vars)",
    "fingerprint": "92988ecf75890d1d",
    "severity": "major",
    "location": {
      "path": "example.js",
      "lines": {
        "begin": 1,
        "end": 1
      }
    }
  }
]

Expected output:

[
  {
    "description": "Variable 'unused' is declared but never used. Unused variables should start with a '_'.",
    "check_name": "eslint(no-unused-vars)",
    "fingerprint": "92988ecf75890d1d",
    "severity": "major",
    "location": {
      "path": "pathFromRepoRoot/example.js",
      "lines": {
        "begin": 1,
        "end": 1
      }
    }
  }
]

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions