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
23
dist/post_run/index.js
vendored
23
dist/post_run/index.js
vendored
|
|
@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) {
|
||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set(userArgs
|
const userArgsList = userArgs
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.replace(/^-+/, ``)));
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
if (userArgNames.has(`out-format`)) {
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
.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`);
|
||||||
}
|
}
|
||||||
addedArgs.push(`--out-format=github-actions`);
|
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
|
|
||||||
23
dist/run/index.js
vendored
23
dist/run/index.js
vendored
|
|
@ -66575,16 +66575,27 @@ function runLint(lintPath, patchPath) {
|
||||||
}
|
}
|
||||||
const userArgs = core.getInput(`args`);
|
const userArgs = core.getInput(`args`);
|
||||||
const addedArgs = [];
|
const addedArgs = [];
|
||||||
const userArgNames = new Set(userArgs
|
const userArgsList = userArgs
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((arg) => arg.split(`=`)[0])
|
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.replace(/^-+/, ``)));
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
if (userArgNames.has(`out-format`)) {
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
.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`);
|
||||||
}
|
}
|
||||||
addedArgs.push(`--out-format=github-actions`);
|
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
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`);
|
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||||
|
|
|
||||||
31
src/run.ts
31
src/run.ts
|
|
@ -119,18 +119,27 @@ 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 userArgsList = userArgs
|
||||||
userArgs
|
.trim()
|
||||||
.trim()
|
.split(/\s+/)
|
||||||
.split(/\s+/)
|
.filter((arg) => arg.startsWith(`-`))
|
||||||
.map((arg) => arg.split(`=`)[0])
|
.map((arg) => arg.replace(/^-+/, ``))
|
||||||
.filter((arg) => arg.startsWith(`-`))
|
.map((arg) => arg.split(/=(.*)/, 2))
|
||||||
.map((arg) => arg.replace(/^-+/, ``))
|
.map<[string, string]>(([key, value]) => [key, value ?? ''])
|
||||||
)
|
|
||||||
if (userArgNames.has(`out-format`)) {
|
const userArgsMap = new Map<string, string>(userArgsList)
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
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`)
|
||||||
}
|
}
|
||||||
addedArgs.push(`--out-format=github-actions`)
|
|
||||||
|
|
||||||
if (patchPath) {
|
if (patchPath) {
|
||||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue