mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-16 15:38:28 +00:00
Extract and don't mangle User Args.
This commit is contained in:
parent
e3c53feccf
commit
92c027dbfa
3 changed files with 6 additions and 24 deletions
10
dist/post_run/index.js
vendored
10
dist/post_run/index.js
vendored
|
|
@ -6811,14 +6811,8 @@ function runLint(lintPath, patchPath) {
|
||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set();
|
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
|
||||||
userArgs
|
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
|
||||||
.split(/\s/)
|
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
|
||||||
.forEach((arg) => {
|
|
||||||
userArgNames.add(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`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
dist/run/index.js
vendored
10
dist/run/index.js
vendored
|
|
@ -6821,14 +6821,8 @@ function runLint(lintPath, patchPath) {
|
||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set();
|
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
|
||||||
userArgs
|
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
|
||||||
.split(/\s/)
|
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
|
||||||
.forEach((arg) => {
|
|
||||||
userArgNames.add(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`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/run.ts
10
src/run.ts
|
|
@ -121,14 +121,8 @@ 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 userArgNames = new Set<string>()
|
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig
|
||||||
userArgs
|
const userArgNames = new Set<string>(userArgs.match(userArgNamesRegex))
|
||||||
.split(/\s/)
|
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
|
||||||
.forEach((arg) => {
|
|
||||||
userArgNames.add(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`)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue