Extract and don't mangle User Args. (#200)

This commit is contained in:
Michael Mulligan 2021-04-04 04:20:31 -04:00 committed by GitHub
parent e3c53feccf
commit 5c56cd6c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 21 deletions

View File

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

10
dist/run/index.js vendored
View File

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

View File

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