Skip to content

Commit

Permalink
Extract and don't mangle User Args.
Browse files Browse the repository at this point in the history
  • Loading branch information
thebeline committed Apr 1, 2021
1 parent e3c53fe commit 92c027d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
10 changes: 2 additions & 8 deletions dist/post_run/index.js
Expand Up @@ -6811,14 +6811,8 @@ function runLint(lintPath, patchPath) {
}
const userArgs = core.getInput(`args`);
const addedArgs = [];
const userArgNames = new Set();
userArgs
.split(/\s/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.forEach((arg) => {
userArgNames.add(arg.replace(`-`, ``));
});
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
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: 2 additions & 8 deletions dist/run/index.js
Expand Up @@ -6821,14 +6821,8 @@ function runLint(lintPath, patchPath) {
}
const userArgs = core.getInput(`args`);
const addedArgs = [];
const userArgNames = new Set();
userArgs
.split(/\s/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.forEach((arg) => {
userArgNames.add(arg.replace(`-`, ``));
});
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
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: 2 additions & 8 deletions src/run.ts
Expand Up @@ -121,14 +121,8 @@ 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 userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig
const userArgNames = new Set<string>(userArgs.match(userArgNamesRegex))

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 92c027d

Please sign in to comment.