Extract and don't mangle User Args.

This commit is contained in:
Michael J Mulligan 2021-04-01 15:25:35 +01:00
parent e3c53feccf
commit 92c027dbfa
3 changed files with 6 additions and 24 deletions

View file

@ -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`);
}

10
dist/run/index.js vendored
View file

@ -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`);
}

View file

@ -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`)