Skip to content

Commit 5c56cd6

Browse files
authored
Extract and don't mangle User Args. (#200)
1 parent e3c53fe commit 5c56cd6

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

dist/post_run/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -6811,14 +6811,12 @@ function runLint(lintPath, patchPath) {
68116811
}
68126812
const userArgs = core.getInput(`args`);
68136813
const addedArgs = [];
6814-
const userArgNames = new Set();
6815-
userArgs
6816-
.split(/\s/)
6814+
const userArgNames = new Set(userArgs
6815+
.trim()
6816+
.split(/\s+/)
68176817
.map((arg) => arg.split(`=`)[0])
68186818
.filter((arg) => arg.startsWith(`-`))
6819-
.forEach((arg) => {
6820-
userArgNames.add(arg.replace(`-`, ``));
6821-
});
6819+
.map((arg) => arg.replace(/^-+/, ``)));
68226820
if (userArgNames.has(`out-format`)) {
68236821
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
68246822
}

dist/run/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -6821,14 +6821,12 @@ function runLint(lintPath, patchPath) {
68216821
}
68226822
const userArgs = core.getInput(`args`);
68236823
const addedArgs = [];
6824-
const userArgNames = new Set();
6825-
userArgs
6826-
.split(/\s/)
6824+
const userArgNames = new Set(userArgs
6825+
.trim()
6826+
.split(/\s+/)
68276827
.map((arg) => arg.split(`=`)[0])
68286828
.filter((arg) => arg.startsWith(`-`))
6829-
.forEach((arg) => {
6830-
userArgNames.add(arg.replace(`-`, ``));
6831-
});
6829+
.map((arg) => arg.replace(/^-+/, ``)));
68326830
if (userArgNames.has(`out-format`)) {
68336831
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
68346832
}

src/run.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,14 @@ 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-
})
132-
124+
const userArgNames = new Set<string>(
125+
userArgs
126+
.trim()
127+
.split(/\s+/)
128+
.map((arg) => arg.split(`=`)[0])
129+
.filter((arg) => arg.startsWith(`-`))
130+
.map((arg) => arg.replace(/^-+/, ``))
131+
)
133132
if (userArgNames.has(`out-format`)) {
134133
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
135134
}

0 commit comments

Comments
 (0)