mirror of
https://github.com/actions-rs/cargo.git
synced 2024-12-22 07:35:48 +02:00
Enabling rustfmt problem matcher on demand
This commit is contained in:
parent
333d0cf286
commit
d45f23b72c
4 changed files with 21 additions and 14 deletions
|
@ -2,11 +2,13 @@
|
|||
"problemMatcher": [
|
||||
{
|
||||
"owner": "rustfmt",
|
||||
"pattern": {
|
||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
}
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
12
dist/.matchers/rustfmt.json
vendored
12
dist/.matchers/rustfmt.json
vendored
|
@ -2,11 +2,13 @@
|
|||
"problemMatcher": [
|
||||
{
|
||||
"owner": "rustfmt",
|
||||
"pattern": {
|
||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
}
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||
"file": 1,
|
||||
"line": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -24,11 +24,14 @@ export async function run(actionInput: input.Input): Promise<void> {
|
|||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const actionInput = input.get();
|
||||
|
||||
const matchersPath = path.join(__dirname, '.matchers');
|
||||
console.log(`::add-matcher::${path.join(matchersPath, 'rust.json')}`);
|
||||
console.log(`::add-matcher::${path.join(matchersPath, 'rustfmt.json')}`);
|
||||
|
||||
const actionInput = input.get();
|
||||
// Enabling `rustfmt` problem matcher only if `cargo fmt` is called
|
||||
if (actionInput.command == 'fmt') {
|
||||
console.log(`::add-matcher::${path.join(matchersPath, 'rustfmt.json')}`);
|
||||
}
|
||||
|
||||
try {
|
||||
await run(actionInput);
|
||||
|
|
Loading…
Reference in a new issue