Merge pull request #13 from giraffate/clippy_flags

Accept Clippy flags
This commit is contained in:
NAKATA Takayuki 2022-11-09 22:27:16 +09:00 committed by GitHub
commit 62b72b4c8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 2 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View file

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