Extract and don't mangle User Args. (#200)
This commit is contained in:
parent
e3c53feccf
commit
5c56cd6c9d
10
dist/post_run/index.js
vendored
10
dist/post_run/index.js
vendored
@ -6811,14 +6811,12 @@ function runLint(lintPath, patchPath) {
|
|||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set();
|
const userArgNames = new Set(userArgs
|
||||||
userArgs
|
.trim()
|
||||||
.split(/\s/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
.map((arg) => arg.split(`=`)[0])
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.forEach((arg) => {
|
.map((arg) => arg.replace(/^-+/, ``)));
|
||||||
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,12 @@ function runLint(lintPath, patchPath) {
|
|||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set();
|
const userArgNames = new Set(userArgs
|
||||||
userArgs
|
.trim()
|
||||||
.split(/\s/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
.map((arg) => arg.split(`=`)[0])
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.forEach((arg) => {
|
.map((arg) => arg.replace(/^-+/, ``)));
|
||||||
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`);
|
||||||
}
|
}
|
||||||
|
17
src/run.ts
17
src/run.ts
@ -121,15 +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 userArgNames = new Set<string>()
|
const userArgNames = new Set<string>(
|
||||||
userArgs
|
userArgs
|
||||||
.split(/\s/)
|
.trim()
|
||||||
.map((arg) => arg.split(`=`)[0])
|
.split(/\s+/)
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.map((arg) => arg.split(`=`)[0])
|
||||||
.forEach((arg) => {
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
userArgNames.add(arg.replace(`-`, ``))
|
.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`)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user