Merge pull request #1903 from github/henrymercer/sublanguage-file-coverage

Enable sub-language file coverage behind a feature flag
This commit is contained in:
Henry Mercer
2023-09-26 17:30:08 +01:00
committed by GitHub
7 changed files with 45 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import {
Feature,
FeatureEnablement,
useCodeScanningConfigInCli,
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
} from "./feature-flags";
import { isTracedLanguage, Language } from "./languages";
import { Logger } from "./logging";
@@ -611,6 +612,19 @@ export async function getCodeQLForCmd(
extraArgs.push("--calculate-language-specific-baseline");
}
if (
await features.getValue(Feature.SublanguageFileCoverageEnabled, this)
) {
extraArgs.push("--sublanguage-file-coverage");
} else if (
await util.codeQlVersionAbove(
this,
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
)
) {
extraArgs.push("--no-sublanguage-file-coverage");
}
await runTool(
cmd,
[

View File

@@ -29,6 +29,11 @@ export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
*/
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
/**
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
*/
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
export interface CodeQLDefaultVersionInfo {
cliVersion: string;
tagName: string;
@@ -59,6 +64,7 @@ export enum Feature {
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
QaTelemetryEnabled = "qa_telemetry_enabled",
SublanguageFileCoverageEnabled = "sublanguage_file_coverage_enabled",
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
}
@@ -111,6 +117,11 @@ export const featureConfig: Record<
minimumVersion: undefined,
defaultValue: false,
},
[Feature.SublanguageFileCoverageEnabled]: {
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
minimumVersion: CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
defaultValue: false,
},
[Feature.UploadFailedSarifEnabled]: {
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
minimumVersion: "2.11.3",