This commit is contained in:
Fernandez Ludovic 2021-04-04 02:48:01 +02:00
parent 92c027dbfa
commit e807442206
3 changed files with 20 additions and 7 deletions

View file

@ -6811,8 +6811,12 @@ function runLint(lintPath, patchPath) {
} }
const userArgs = core.getInput(`args`); const userArgs = core.getInput(`args`);
const addedArgs = []; const addedArgs = [];
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig; const userArgNames = new Set(userArgs
const userArgNames = new Set(userArgs.match(userArgNamesRegex)); .trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.map((arg) => arg.replace(/^-+/, ``)));
if (userArgNames.has(`out-format`)) { if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
} }

8
dist/run/index.js vendored
View file

@ -6821,8 +6821,12 @@ function runLint(lintPath, patchPath) {
} }
const userArgs = core.getInput(`args`); const userArgs = core.getInput(`args`);
const addedArgs = []; const addedArgs = [];
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig; const userArgNames = new Set(userArgs
const userArgNames = new Set(userArgs.match(userArgNamesRegex)); .trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.map((arg) => arg.replace(/^-+/, ``)));
if (userArgNames.has(`out-format`)) { if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`); throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
} }

View file

@ -121,9 +121,14 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
const userArgs = core.getInput(`args`) const userArgs = core.getInput(`args`)
const addedArgs: string[] = [] const addedArgs: string[] = []
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig const userArgNames = new Set<string>(
const userArgNames = new Set<string>(userArgs.match(userArgNamesRegex)) userArgs
.trim()
.split(/\s+/)
.map((arg) => arg.split(`=`)[0])
.filter((arg) => arg.startsWith(`-`))
.map((arg) => arg.replace(/^-+/, ``))
)
if (userArgNames.has(`out-format`)) { if (userArgNames.has(`out-format`)) {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`) throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
} }