Skip to content

Extract and don't mangle User Args. #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions dist/post_run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
Expand Down
10 changes: 4 additions & 6 deletions dist/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
Expand Down
17 changes: 8 additions & 9 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
Expand Down