mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-16 23:48:27 +00:00
parent
8c13ec4e5d
commit
8d9a4ff3ee
3 changed files with 54 additions and 23 deletions
21
dist/post_run/index.js
vendored
21
dist/post_run/index.js
vendored
|
|
@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) {
|
|||
}
|
||||
const userArgs = core.getInput(`args`);
|
||||
const addedArgs = [];
|
||||
const userArgNames = new Set(userArgs
|
||||
const userArgsList = 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`);
|
||||
.map((arg) => arg.replace(/^-+/, ``))
|
||||
.map((arg) => arg.split(/=(.*)/, 2))
|
||||
.map(([key, value]) => [key, value !== null && value !== void 0 ? value : '']);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key, value]) => key));
|
||||
const formats = userArgsMap.get('out-format');
|
||||
if (formats) {
|
||||
if (formats.includes('github-actions')) {
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
}
|
||||
else {
|
||||
addedArgs.push(`--out-format=github-actions,${formats}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addedArgs.push(`--out-format=github-actions`);
|
||||
}
|
||||
if (patchPath) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||
|
|
|
|||
21
dist/run/index.js
vendored
21
dist/run/index.js
vendored
|
|
@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) {
|
|||
}
|
||||
const userArgs = core.getInput(`args`);
|
||||
const addedArgs = [];
|
||||
const userArgNames = new Set(userArgs
|
||||
const userArgsList = 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`);
|
||||
.map((arg) => arg.replace(/^-+/, ``))
|
||||
.map((arg) => arg.split(/=(.*)/, 2))
|
||||
.map(([key, value]) => [key, value !== null && value !== void 0 ? value : '']);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key, value]) => key));
|
||||
const formats = userArgsMap.get('out-format');
|
||||
if (formats) {
|
||||
if (formats.includes('github-actions')) {
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
}
|
||||
else {
|
||||
addedArgs.push(`--out-format=github-actions,${formats}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addedArgs.push(`--out-format=github-actions`);
|
||||
}
|
||||
if (patchPath) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||
|
|
|
|||
21
src/run.ts
21
src/run.ts
|
|
@ -119,18 +119,27 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
|||
const userArgs = core.getInput(`args`)
|
||||
const addedArgs: string[] = []
|
||||
|
||||
const userArgNames = new Set<string>(
|
||||
userArgs
|
||||
const userArgsList = 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`)
|
||||
.map((arg) => arg.split(/=(.*)/, 2))
|
||||
.map<[string, string]>(([key, value]) => [key, value ?? ''])
|
||||
|
||||
const userArgsMap = new Map<string, string>(userArgsList)
|
||||
const userArgNames = new Set<string>(userArgsList.map(([key, value]) => key));
|
||||
|
||||
const formats = userArgsMap.get('out-format')
|
||||
if (formats) {
|
||||
if (formats.includes('github-actions')) {
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
} else {
|
||||
addedArgs.push(`--out-format=github-actions,${formats}`)
|
||||
}
|
||||
} else {
|
||||
addedArgs.push(`--out-format=github-actions`)
|
||||
}
|
||||
|
||||
if (patchPath) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue