Enable sub-language file coverage behind a ff
This commit is contained in:
parent
650a85ef6d
commit
41d2ffad87
6 changed files with 44 additions and 3 deletions
6
lib/codeql.js
generated
6
lib/codeql.js
generated
|
|
@ -297,6 +297,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||||
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||||
extraArgs.push("--calculate-language-specific-baseline");
|
extraArgs.push("--calculate-language-specific-baseline");
|
||||||
}
|
}
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||||
|
extraArgs.push("--sublanguage-file-coverage");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||||
|
extraArgs.push("--no-sublanguage-file-coverage");
|
||||||
|
}
|
||||||
await runTool(cmd, [
|
await runTool(cmd, [
|
||||||
"database",
|
"database",
|
||||||
"init",
|
"init",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
12
lib/feature-flags.js
generated
12
lib/feature-flags.js
generated
|
|
@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
|
|
@ -45,6 +45,10 @@ exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||||
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
|
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
|
||||||
*/
|
*/
|
||||||
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
||||||
|
/**
|
||||||
|
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
||||||
/**
|
/**
|
||||||
* Feature enablement as returned by the GitHub API endpoint.
|
* Feature enablement as returned by the GitHub API endpoint.
|
||||||
*
|
*
|
||||||
|
|
@ -62,6 +66,7 @@ var Feature;
|
||||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||||
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||||
|
Feature["SublanguageFileCoverageEnabled"] = "sublanguage_file_coverage_enabled";
|
||||||
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
||||||
})(Feature || (exports.Feature = Feature = {}));
|
})(Feature || (exports.Feature = Feature = {}));
|
||||||
exports.featureConfig = {
|
exports.featureConfig = {
|
||||||
|
|
@ -110,6 +115,11 @@ exports.featureConfig = {
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
|
[Feature.SublanguageFileCoverageEnabled]: {
|
||||||
|
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
|
||||||
|
minimumVersion: exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
[Feature.UploadFailedSarifEnabled]: {
|
[Feature.UploadFailedSarifEnabled]: {
|
||||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||||
minimumVersion: "2.11.3",
|
minimumVersion: "2.11.3",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -20,6 +20,7 @@ import {
|
||||||
Feature,
|
Feature,
|
||||||
FeatureEnablement,
|
FeatureEnablement,
|
||||||
useCodeScanningConfigInCli,
|
useCodeScanningConfigInCli,
|
||||||
|
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import { isTracedLanguage, Language } from "./languages";
|
import { isTracedLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
|
|
@ -611,6 +612,19 @@ export async function getCodeQLForCmd(
|
||||||
extraArgs.push("--calculate-language-specific-baseline");
|
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(
|
await runTool(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||||
*/
|
*/
|
||||||
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
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 {
|
export interface CodeQLDefaultVersionInfo {
|
||||||
cliVersion: string;
|
cliVersion: string;
|
||||||
tagName: string;
|
tagName: string;
|
||||||
|
|
@ -59,6 +64,7 @@ export enum Feature {
|
||||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||||
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
||||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||||
|
SublanguageFileCoverageEnabled = "sublanguage_file_coverage_enabled",
|
||||||
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
|
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,6 +117,11 @@ export const featureConfig: Record<
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
|
[Feature.SublanguageFileCoverageEnabled]: {
|
||||||
|
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
|
||||||
|
minimumVersion: CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
[Feature.UploadFailedSarifEnabled]: {
|
[Feature.UploadFailedSarifEnabled]: {
|
||||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||||
minimumVersion: "2.11.3",
|
minimumVersion: "2.11.3",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue