Skip to content

Commit 35619fd

Browse files
authored
Add problem matchers (#26)
Closes: #12
1 parent c918545 commit 35619fd

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

.github/matchers/check.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "ruff-check",
5+
"pattern": [
6+
{
7+
"regexp": "^Error: (.*):(\\d+):(\\d+): (\\w+) (.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"code": 4,
12+
"message": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/matchers/format.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "ruff-format",
5+
"pattern": [
6+
{
7+
"regexp": "^(Would reformat):\\s*(.+)$",
8+
"message": 1,
9+
"file": 2
10+
}
11+
]
12+
}
13+
]
14+
}

dist/ruff-action/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ruff-action.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async function run(): Promise<void> {
3636

3737
addRuffToPath(setupResult.ruffDir);
3838
setOutputFormat();
39+
addMatchers();
3940
core.setOutput("ruff-version", setupResult.version);
4041
core.info(`Successfully installed ruff version ${setupResult.version}`);
4142

@@ -92,6 +93,17 @@ function setOutputFormat() {
9293
core.info("Set RUFF_OUTPUT_FORMAT to github");
9394
}
9495

96+
function addMatchers(): void {
97+
const matchersPath = path.join(
98+
__dirname,
99+
`..${path.sep}..`,
100+
".github",
101+
"matchers",
102+
);
103+
core.info(`##[add-matcher]${path.join(matchersPath, "check.json")}`);
104+
core.info(`##[add-matcher]${path.join(matchersPath, "format.json")}`);
105+
}
106+
95107
async function runRuff(
96108
ruffExecutablePath: string,
97109
args: string[],

0 commit comments

Comments
 (0)