Accept Clippy flags

This commit is contained in:
Takayuki Nakata 2022-11-09 22:22:37 +09:00
parent 1220ab17a8
commit a1bead11ea
3 changed files with 5 additions and 5 deletions

4
dist/index.js generated vendored
View file

@ -156,6 +156,7 @@ function run() {
try {
const reviewdogVersion = core.getInput('reviewdog_version') || 'latest';
const toolName = core.getInput('tool_name') || 'clippy';
const clippyFlags = core.getInput('clippy_flags');
const level = core.getInput('level') || 'error';
const reporter = core.getInput('reporter') || 'github-pr-check';
const filterMode = core.getInput('filter_mode') || 'added';
@ -168,7 +169,7 @@ function run() {
}));
const code = yield core.group('Running Clippy with reviewdog 🐶 ...', () => __awaiter(this, void 0, void 0, function* () {
const output = [];
yield exec.exec('cargo', ['clippy', '--color', 'never', '-q', '--message-format', 'json'], {
yield exec.exec('cargo', ['clippy', '--color', 'never', '-q', '--message-format', 'json', ...parse(clippyFlags)], {
cwd,
ignoreReturnCode: true,
listeners: {
@ -250,7 +251,6 @@ function parse(flags) {
if (flags === '') {
return [];
}
// TODO: need to simulate bash?
return flags.split(/\s+/);
}
run();

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -13,6 +13,7 @@ async function run(): Promise<void> {
try {
const reviewdogVersion = core.getInput('reviewdog_version') || 'latest'
const toolName = core.getInput('tool_name') || 'clippy'
const clippyFlags = core.getInput('clippy_flags');
const level = core.getInput('level') || 'error'
const reporter = core.getInput('reporter') || 'github-pr-check'
const filterMode = core.getInput('filter_mode') || 'added'
@ -37,7 +38,7 @@ async function run(): Promise<void> {
const output: string[] = []
await exec.exec(
'cargo',
['clippy', '--color', 'never', '-q', '--message-format', 'json'],
['clippy', '--color', 'never', '-q', '--message-format', 'json', ...parse(clippyFlags)],
{
cwd,
ignoreReturnCode: true,
@ -128,7 +129,6 @@ function parse(flags: string): string[] {
return []
}
// TODO: need to simulate bash?
return flags.split(/\s+/)
}