Merge pull request #2191 from github/henrymercer/use-include-query-help-flag

Use the `--sarif-include-query-help` option when supported
This commit is contained in:
Henry Mercer 2024-03-11 18:57:47 +00:00 committed by GitHub
commit 69e120d747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 5 deletions

14
lib/codeql.js generated
View file

@ -110,6 +110,10 @@ exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
*/
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
/**
* Versions 2.15.2+ of the CodeQL CLI support the `--sarif-include-query-help` option.
*/
const CODEQL_VERSION_INCLUDE_QUERY_HELP = "2.15.2";
/**
* Set up CodeQL CLI access.
*
@ -492,9 +496,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"--print-diagnostics-summary",
"--print-metrics-summary",
"--sarif-add-baseline-file-info",
"--sarif-add-query-help",
"--sarif-group-rules-by-pack",
...(await getCodeScanningConfigExportArguments(config, this)),
"--sarif-group-rules-by-pack",
...(await getCodeScanningQueryHelpArguments(this)),
...getExtraOptionsFromEnv(["database", "interpret-results"]),
];
if (automationDetailsId !== undefined) {
@ -911,4 +915,10 @@ async function isSublanguageFileCoverageEnabled(config, codeql) {
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)));
}
async function getCodeScanningQueryHelpArguments(codeql) {
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_INCLUDE_QUERY_HELP)) {
return ["--sarif-include-query-help=always"];
}
return ["--sarif-add-query-help"];
}
//# sourceMappingURL=codeql.js.map

File diff suppressed because one or more lines are too long

View file

@ -334,6 +334,11 @@ export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
*/
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
/**
* Versions 2.15.2+ of the CodeQL CLI support the `--sarif-include-query-help` option.
*/
const CODEQL_VERSION_INCLUDE_QUERY_HELP = "2.15.2";
/**
* Set up CodeQL CLI access.
*
@ -855,9 +860,9 @@ export async function getCodeQLForCmd(
"--print-diagnostics-summary",
"--print-metrics-summary",
"--sarif-add-baseline-file-info",
"--sarif-add-query-help",
"--sarif-group-rules-by-pack",
...(await getCodeScanningConfigExportArguments(config, this)),
"--sarif-group-rules-by-pack",
...(await getCodeScanningQueryHelpArguments(this)),
...getExtraOptionsFromEnv(["database", "interpret-results"]),
];
if (automationDetailsId !== undefined) {
@ -1389,3 +1394,14 @@ async function isSublanguageFileCoverageEnabled(
))
);
}
async function getCodeScanningQueryHelpArguments(
codeql: CodeQL,
): Promise<string[]> {
if (
await util.codeQlVersionAbove(codeql, CODEQL_VERSION_INCLUDE_QUERY_HELP)
) {
return ["--sarif-include-query-help=always"];
}
return ["--sarif-add-query-help"];
}