Remove feature flag for sub-language file coverage information
This commit is contained in:
parent
2cbabeaa72
commit
c8e99083da
6 changed files with 41 additions and 36 deletions
21
lib/codeql.js
generated
21
lib/codeql.js
generated
|
|
@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CommandInvocationError = void 0;
|
||||
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CommandInvocationError = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
|
|
@ -131,6 +131,10 @@ exports.CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
|
|||
* Versions 2.15.0+ of the CodeQL CLI support new analysis summaries.
|
||||
*/
|
||||
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";
|
||||
/**
|
||||
* Set up CodeQL CLI access.
|
||||
*
|
||||
|
|
@ -301,10 +305,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||
extraArgs.push("--calculate-language-specific-baseline");
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
extraArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
await runTool(cmd, [
|
||||
|
|
@ -511,10 +515,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
codeqlArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
codeqlArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
if (shouldExportDiagnostics) {
|
||||
|
|
@ -992,4 +996,11 @@ async function getLanguageAliasingArguments(codeql) {
|
|||
}
|
||||
return [];
|
||||
}
|
||||
async function isSublanguageFileCoverageEnabled(config, codeql) {
|
||||
return (
|
||||
// Sub-language file coverage is first supported in GHES 3.12.
|
||||
(config.gitHubVersion.type !== util.GitHubVariant.GHES ||
|
||||
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
|
||||
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)));
|
||||
}
|
||||
//# sourceMappingURL=codeql.js.map
|
||||
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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const semver = __importStar(require("semver"));
|
||||
|
|
@ -41,10 +41,6 @@ exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
|
|||
* 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";
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
@ -60,7 +56,6 @@ var Feature;
|
|||
Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled";
|
||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||
Feature["SublanguageFileCoverageEnabled"] = "sublanguage_file_coverage_enabled";
|
||||
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
||||
})(Feature || (exports.Feature = Feature = {}));
|
||||
exports.featureConfig = {
|
||||
|
|
@ -99,11 +94,6 @@ exports.featureConfig = {
|
|||
minimumVersion: undefined,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.SublanguageFileCoverageEnabled]: {
|
||||
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
|
||||
minimumVersion: exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.UploadFailedSarifEnabled]: {
|
||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||
minimumVersion: "2.11.3",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -20,7 +20,6 @@ import {
|
|||
Feature,
|
||||
FeatureEnablement,
|
||||
useCodeScanningConfigInCli,
|
||||
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
} from "./feature-flags";
|
||||
import { isTracedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
|
|
@ -367,6 +366,11 @@ export const CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
|
|||
*/
|
||||
export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
|
||||
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||
*/
|
||||
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
|
||||
|
||||
/**
|
||||
* Set up CodeQL CLI access.
|
||||
*
|
||||
|
|
@ -620,9 +624,7 @@ export async function getCodeQLForCmd(
|
|||
extraArgs.push("--calculate-language-specific-baseline");
|
||||
}
|
||||
|
||||
if (
|
||||
await features.getValue(Feature.SublanguageFileCoverageEnabled, this)
|
||||
) {
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
extraArgs.push("--sublanguage-file-coverage");
|
||||
} else if (
|
||||
await util.codeQlVersionAbove(
|
||||
|
|
@ -913,9 +915,7 @@ export async function getCodeQLForCmd(
|
|||
) {
|
||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||
}
|
||||
if (
|
||||
await features.getValue(Feature.SublanguageFileCoverageEnabled, this)
|
||||
) {
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
codeqlArgs.push("--sublanguage-file-coverage");
|
||||
} else if (
|
||||
await util.codeQlVersionAbove(
|
||||
|
|
@ -1509,3 +1509,18 @@ async function getLanguageAliasingArguments(codeql: CodeQL): Promise<string[]> {
|
|||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
async function isSublanguageFileCoverageEnabled(
|
||||
config: Config,
|
||||
codeql: CodeQL,
|
||||
) {
|
||||
return (
|
||||
// Sub-language file coverage is first supported in GHES 3.12.
|
||||
(config.gitHubVersion.type !== util.GitHubVariant.GHES ||
|
||||
semver.gte(config.gitHubVersion.version, "3.12.0")) &&
|
||||
(await util.codeQlVersionAbove(
|
||||
codeql,
|
||||
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
|
||||
))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@ export const CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
|
|||
*/
|
||||
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;
|
||||
|
|
@ -57,7 +52,6 @@ export enum Feature {
|
|||
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
|
||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||
SublanguageFileCoverageEnabled = "sublanguage_file_coverage_enabled",
|
||||
UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
|
||||
}
|
||||
|
||||
|
|
@ -100,11 +94,6 @@ 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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue