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:
commit
69e120d747
3 changed files with 31 additions and 5 deletions
14
lib/codeql.js
generated
14
lib/codeql.js
generated
|
|
@ -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.
|
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||||
*/
|
*/
|
||||||
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
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.
|
* Set up CodeQL CLI access.
|
||||||
*
|
*
|
||||||
|
|
@ -492,9 +496,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||||
"--print-diagnostics-summary",
|
"--print-diagnostics-summary",
|
||||||
"--print-metrics-summary",
|
"--print-metrics-summary",
|
||||||
"--sarif-add-baseline-file-info",
|
"--sarif-add-baseline-file-info",
|
||||||
"--sarif-add-query-help",
|
|
||||||
"--sarif-group-rules-by-pack",
|
|
||||||
...(await getCodeScanningConfigExportArguments(config, this)),
|
...(await getCodeScanningConfigExportArguments(config, this)),
|
||||||
|
"--sarif-group-rules-by-pack",
|
||||||
|
...(await getCodeScanningQueryHelpArguments(this)),
|
||||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||||
];
|
];
|
||||||
if (automationDetailsId !== undefined) {
|
if (automationDetailsId !== undefined) {
|
||||||
|
|
@ -911,4 +915,10 @@ async function isSublanguageFileCoverageEnabled(config, codeql) {
|
||||||
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
|
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
|
||||||
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)));
|
(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
|
//# sourceMappingURL=codeql.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -334,6 +334,11 @@ export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
|
||||||
*/
|
*/
|
||||||
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "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.
|
* Set up CodeQL CLI access.
|
||||||
*
|
*
|
||||||
|
|
@ -855,9 +860,9 @@ export async function getCodeQLForCmd(
|
||||||
"--print-diagnostics-summary",
|
"--print-diagnostics-summary",
|
||||||
"--print-metrics-summary",
|
"--print-metrics-summary",
|
||||||
"--sarif-add-baseline-file-info",
|
"--sarif-add-baseline-file-info",
|
||||||
"--sarif-add-query-help",
|
|
||||||
"--sarif-group-rules-by-pack",
|
|
||||||
...(await getCodeScanningConfigExportArguments(config, this)),
|
...(await getCodeScanningConfigExportArguments(config, this)),
|
||||||
|
"--sarif-group-rules-by-pack",
|
||||||
|
...(await getCodeScanningQueryHelpArguments(this)),
|
||||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||||
];
|
];
|
||||||
if (automationDetailsId !== undefined) {
|
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"];
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue