Skip to content

Commit

Permalink
Extract and don't mangle User Args. (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
thebeline committed Apr 4, 2021
1 parent e3c53fe commit 5c56cd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
10 changes: 4 additions & 6 deletions dist/post_run/index.js
Expand Up @@ -6811,14 +6811,12 @@ function runLint(lintPath, patchPath) {
}
const userArgs = core.getInput(`args`);
const addedArgs = [];
const userArgNames = new Set();
userArgs
.split(/\s/)
const userArgNames = new Set(userArgs
.trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.forEach((arg) => {
userArgNames.add(arg.replace(`-`, ``));
});
.map((arg) => arg.replace(/^-+/, ``)));
if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
}
Expand Down
10 changes: 4 additions & 6 deletions dist/run/index.js
Expand Up @@ -6821,14 +6821,12 @@ function runLint(lintPath, patchPath) {
}
const userArgs = core.getInput(`args`);
const addedArgs = [];
const userArgNames = new Set();
userArgs
.split(/\s/)
const userArgNames = new Set(userArgs
.trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.forEach((arg) => {
userArgNames.add(arg.replace(`-`, ``));
});
.map((arg) => arg.replace(/^-+/, ``)));
if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
}
Expand Down
17 changes: 8 additions & 9 deletions src/run.ts
Expand Up @@ -121,15 +121,14 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
const userArgs = core.getInput(`args`)
const addedArgs: string[] = []

const userArgNames = new Set<string>()
userArgs
.split(/\s/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.forEach((arg) => {
userArgNames.add(arg.replace(`-`, ``))
})

const userArgNames = new Set<string>(
userArgs
.trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.map((arg) => arg.replace(/^-+/, ``))
)
if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
}
Expand Down

0 comments on commit 5c56cd6

Please sign in to comment.