Skip to content

Commit

Permalink
Add problem matchers (#26)
Browse files Browse the repository at this point in the history
Closes: #12
  • Loading branch information
eifinger authored Dec 8, 2024
1 parent c918545 commit 35619fd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/matchers/check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "ruff-check",
"pattern": [
{
"regexp": "^Error: (.*):(\\d+):(\\d+): (\\w+) (.*)$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
]
}
]
}
14 changes: 14 additions & 0 deletions .github/matchers/format.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"problemMatcher": [
{
"owner": "ruff-format",
"pattern": [
{
"regexp": "^(Would reformat):\\s*(.+)$",
"message": 1,
"file": 2
}
]
}
]
}
6 changes: 6 additions & 0 deletions dist/ruff-action/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/ruff-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function run(): Promise<void> {

addRuffToPath(setupResult.ruffDir);
setOutputFormat();
addMatchers();
core.setOutput("ruff-version", setupResult.version);
core.info(`Successfully installed ruff version ${setupResult.version}`);

Expand Down Expand Up @@ -92,6 +93,17 @@ function setOutputFormat() {
core.info("Set RUFF_OUTPUT_FORMAT to github");
}

function addMatchers(): void {
const matchersPath = path.join(
__dirname,
`..${path.sep}..`,
".github",
"matchers",
);
core.info(`##[add-matcher]${path.join(matchersPath, "check.json")}`);
core.info(`##[add-matcher]${path.join(matchersPath, "format.json")}`);
}

async function runRuff(
ruffExecutablePath: string,
args: string[],
Expand Down

0 comments on commit 35619fd

Please sign in to comment.