Skip to content

Commit 3dc47a2

Browse files
committed
Rename snippets to candidates for clarity.
1 parent bce391b commit 3dc47a2

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

lib/cli-errors.js

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cli-errors.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli-errors.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,9 @@ export enum CliConfigErrorCategory {
113113
}
114114

115115
type CliErrorConfiguration = {
116-
/** One of these snippets, or the exit code, must be present in the error message. */
117-
cliErrorMessageSnippets: RegExp[];
116+
/** One of these candidates, or the exit code, must be present in the error message. */
117+
cliErrorMessageCandidates: RegExp[];
118118
exitCode?: number;
119-
// Optional additional message to append for this type of CLI error.
120119
additionalErrorMessageToAppend?: string;
121120
};
122121

@@ -130,12 +129,12 @@ export const cliErrorsConfig: Record<
130129
> = {
131130
// Version of CodeQL CLI is incompatible with this version of the CodeQL Action
132131
[CliConfigErrorCategory.IncompatibleWithActionVersion]: {
133-
cliErrorMessageSnippets: [
132+
cliErrorMessageCandidates: [
134133
new RegExp("is not compatible with this CodeQL CLI"),
135134
],
136135
},
137136
[CliConfigErrorCategory.InitCalledTwice]: {
138-
cliErrorMessageSnippets: [
137+
cliErrorMessageCandidates: [
139138
new RegExp(
140139
"Refusing to create databases .* but could not process any of it",
141140
),
@@ -144,15 +143,15 @@ export const cliErrorsConfig: Record<
144143
},
145144
// Expected source location for database creation does not exist
146145
[CliConfigErrorCategory.InvalidSourceRoot]: {
147-
cliErrorMessageSnippets: [new RegExp("Invalid source root")],
146+
cliErrorMessageCandidates: [new RegExp("Invalid source root")],
148147
},
149148
[CliConfigErrorCategory.NoBuildCommandAutodetected]: {
150-
cliErrorMessageSnippets: [
149+
cliErrorMessageCandidates: [
151150
new RegExp("Could not auto-detect a suitable build method"),
152151
],
153152
},
154153
[CliConfigErrorCategory.NoBuildMethodAutodetected]: {
155-
cliErrorMessageSnippets: [
154+
cliErrorMessageCandidates: [
156155
new RegExp(
157156
"Could not detect a suitable build command for the source checkout",
158157
),
@@ -162,7 +161,7 @@ export const cliErrorsConfig: Record<
162161
// was unintended to have CodeQL analysis run on it.
163162
[CliConfigErrorCategory.NoSourceCodeSeen]: {
164163
exitCode: 32,
165-
cliErrorMessageSnippets: [
164+
cliErrorMessageCandidates: [
166165
new RegExp(
167166
"CodeQL detected code written in .* but could not process any of it",
168167
),
@@ -182,12 +181,14 @@ export const cliErrorsConfig: Record<
182181
},
183182

184183
[CliConfigErrorCategory.NoSupportedBuildCommandSucceeded]: {
185-
cliErrorMessageSnippets: [
184+
cliErrorMessageCandidates: [
186185
new RegExp("No supported build command succeeded"),
187186
],
188187
},
189188
[CliConfigErrorCategory.NoSupportedBuildSystemDetected]: {
190-
cliErrorMessageSnippets: [new RegExp("No supported build system detected")],
189+
cliErrorMessageCandidates: [
190+
new RegExp("No supported build system detected"),
191+
],
191192
},
192193
};
193194

@@ -209,7 +210,7 @@ export function getCliConfigCategoryIfExists(
209210
return category as CliConfigErrorCategory;
210211
}
211212

212-
for (const e of configuration.cliErrorMessageSnippets) {
213+
for (const e of configuration.cliErrorMessageCandidates) {
213214
if (cliError.message.match(e) || cliError.stderr.match(e)) {
214215
return category as CliConfigErrorCategory;
215216
}

0 commit comments

Comments
 (0)