Skip to content

Commit 92c027d

Browse files
committed
Extract and don't mangle User Args.
1 parent e3c53fe commit 92c027d

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

dist/post_run/index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6811,14 +6811,8 @@ function runLint(lintPath, patchPath) {
68116811
}
68126812
const userArgs = core.getInput(`args`);
68136813
const addedArgs = [];
6814-
const userArgNames = new Set();
6815-
userArgs
6816-
.split(/\s/)
6817-
.map((arg) => arg.split(`=`)[0])
6818-
.filter((arg) => arg.startsWith(`-`))
6819-
.forEach((arg) => {
6820-
userArgNames.add(arg.replace(`-`, ``));
6821-
});
6814+
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
6815+
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
68226816
if (userArgNames.has(`out-format`)) {
68236817
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
68246818
}

dist/run/index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6821,14 +6821,8 @@ function runLint(lintPath, patchPath) {
68216821
}
68226822
const userArgs = core.getInput(`args`);
68236823
const addedArgs = [];
6824-
const userArgNames = new Set();
6825-
userArgs
6826-
.split(/\s/)
6827-
.map((arg) => arg.split(`=`)[0])
6828-
.filter((arg) => arg.startsWith(`-`))
6829-
.forEach((arg) => {
6830-
userArgNames.add(arg.replace(`-`, ``));
6831-
});
6824+
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig;
6825+
const userArgNames = new Set(userArgs.match(userArgNamesRegex));
68326826
if (userArgNames.has(`out-format`)) {
68336827
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
68346828
}

src/run.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,8 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
121121
const userArgs = core.getInput(`args`)
122122
const addedArgs: string[] = []
123123

124-
const userArgNames = new Set<string>()
125-
userArgs
126-
.split(/\s/)
127-
.map((arg) => arg.split(`=`)[0])
128-
.filter((arg) => arg.startsWith(`-`))
129-
.forEach((arg) => {
130-
userArgNames.add(arg.replace(`-`, ``))
131-
})
124+
const userArgNamesRegex = /(?<=(^|\s)-+\b)([^\s=]+)(?==)/ig
125+
const userArgNames = new Set<string>(userArgs.match(userArgNamesRegex))
132126

133127
if (userArgNames.has(`out-format`)) {
134128
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)

0 commit comments

Comments
 (0)