Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/debug-artifacts-failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
shell: bash
run: |
LANGUAGES="cpp csharp go java javascript python"
pushd "./my-debug-artifacts"
cd "./my-debug-artifacts"
echo "Artifacts from run:"
for language in $LANGUAGES; do
echo "- Checking $language"
Expand All @@ -82,6 +82,5 @@ jobs:
exit 1
fi
done
popd
env:
GO111MODULE: auto
37 changes: 36 additions & 1 deletion lib/cli-errors.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/cli-errors.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

37 changes: 36 additions & 1 deletion src/cli-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,16 @@ function ensureEndsInPeriod(text: string): string {

/** Error messages from the CLI that we consider configuration errors and handle specially. */
export enum CliConfigErrorCategory {
DetectedCodeButCouldNotProcess = "DetectedCodeButCouldNotProcess",
IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
InitCalledTwice = "InitCalledTwice",
InvalidSourceRoot = "InvalidSourceRoot",
NoJavaScriptTypeScriptCodeFound = "NoJavaScriptTypeScriptCodeFound",
NoBuildCommandAutodetected = "NoBuildCommandAutodetected",
NoBuildMethodAutodetected = "NoBuildMethodAutodetected",
NoSupportedBuildCommandSucceeded = "NoSupportedBuildCommandSucceeded",
NoSupportedBuildSystemDetected = "NoSupportedBuildSystemDetected",
NoSupportedLanguagesDetected = "NoSupportedLanguagesDetected",
}

type CliErrorConfiguration = {
Expand All @@ -121,6 +127,15 @@ export const cliErrorsConfig: Record<
CliConfigErrorCategory,
CliErrorConfiguration
> = {
// Usually when a manual build script has failed, or if an autodetected language
// was unintended to have CodeQL analysis run on it.
[CliConfigErrorCategory.DetectedCodeButCouldNotProcess]: {
Comment thread
henrymercer marked this conversation as resolved.
Outdated
cliErrorMessageSnippets: [
Comment thread
henrymercer marked this conversation as resolved.
Outdated
"CodeQL detected code written in",
"but could not process any of it",
],
additionalErrorMessageToPrepend: `Check the build script, if applicable, for the language specified in the error:`,
Comment thread
henrymercer marked this conversation as resolved.
Outdated
},
// Version of CodeQL CLI is incompatible with this version of the CodeQL Action
[CliConfigErrorCategory.IncompatibleWithActionVersion]: {
cliErrorMessageSnippets: ["is not compatible with this CodeQL CLI"],
Expand All @@ -142,7 +157,8 @@ export const cliErrorsConfig: Record<
* `codeql database finalize`. To ensure users get a good error message, we detect this manually
* here, and upon detection override the error message.
*
* This can be removed once support for CodeQL 2.11.6 is removed.
* This can be removed once support for CodeQL 2.11.6 is removed, and once removed, exit code 32
* can be applied to the DetectedCodeButCouldNotProcess category.
*/
[CliConfigErrorCategory.NoJavaScriptTypeScriptCodeFound]: {
exitCode: 32,
Comment thread
angelapwen marked this conversation as resolved.
Outdated
Expand All @@ -151,6 +167,25 @@ export const cliErrorsConfig: Record<
"No code found during the build. Please see: " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.",
},
[CliConfigErrorCategory.NoBuildCommandAutodetected]: {
cliErrorMessageSnippets: ["Could not auto-detect a suitable build method"],
},
[CliConfigErrorCategory.NoBuildMethodAutodetected]: {
cliErrorMessageSnippets: [
"Could not detect a suitable build command for the source checkout",
],
},
[CliConfigErrorCategory.NoSupportedBuildCommandSucceeded]: {
cliErrorMessageSnippets: ["No supported build command succeeded"],
},
[CliConfigErrorCategory.NoSupportedBuildSystemDetected]: {
cliErrorMessageSnippets: ["No supported build system detected"],
},
[CliConfigErrorCategory.NoSupportedLanguagesDetected]: {
cliErrorMessageSnippets: [
"CodeQL did not detect any code written in languages supported by CodeQL",
],
Comment thread
angelapwen marked this conversation as resolved.
},
};

// Check if the given CLI error or exit code, if applicable, apply to any known
Expand Down
4 changes: 3 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,9 @@ export async function getCodeQLForCmd(

if (
config.buildMode !== undefined &&
(await this.supportsFeature(ToolsFeature.BuildModeOption))
(await this.supportsFeature(
ToolsFeature.BuildModeOption as ToolsFeature,
Comment thread
angelapwen marked this conversation as resolved.
Outdated
))
) {
extraArgs.push(`--build-mode=${config.buildMode}`);
}
Expand Down