Enabling rustfmt problem matcher on demand

This commit is contained in:
svartalf 2019-10-22 14:35:28 +03:00
parent 333d0cf286
commit d45f23b72c
4 changed files with 21 additions and 14 deletions

View file

@ -2,11 +2,13 @@
"problemMatcher": [
{
"owner": "rustfmt",
"pattern": {
"pattern": [
{
"regexp": "^Diff in (\\S+) at line (\\d+):$",
"file": 1,
"line": 2
}
]
}
]
}

View file

@ -2,11 +2,13 @@
"problemMatcher": [
{
"owner": "rustfmt",
"pattern": {
"pattern": [
{
"regexp": "^Diff in (\\S+) at line (\\d+):$",
"file": 1,
"line": 2
}
]
}
]
}

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -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')}`);
// Enabling `rustfmt` problem matcher only if `cargo fmt` is called
if (actionInput.command == 'fmt') {
console.log(`::add-matcher::${path.join(matchersPath, 'rustfmt.json')}`);
const actionInput = input.get();
}
try {
await run(actionInput);