Enable language specific baselines via feature flag
This commit is contained in:
parent
9a510d9b07
commit
8a7b2e9c9b
6 changed files with 45 additions and 3 deletions
6
lib/codeql.js
generated
6
lib/codeql.js
generated
|
|
@ -278,6 +278,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||||
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
||||||
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
||||||
}
|
}
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.LanguageBaselineConfigEnabled, this)) {
|
||||||
|
extraArgs.push("--calculate-language-specific-baseline");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||||
|
extraArgs.push("--no-calculate-language-specific-baseline");
|
||||||
|
}
|
||||||
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_LANGUAGE_BASELINE_CONFIG = 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"));
|
||||||
|
|
@ -44,6 +44,10 @@ exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options.
|
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options.
|
||||||
*/
|
*/
|
||||||
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
||||||
|
/**
|
||||||
|
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
|
||||||
/**
|
/**
|
||||||
* Feature enablement as returned by the GitHub API endpoint.
|
* Feature enablement as returned by the GitHub API endpoint.
|
||||||
*
|
*
|
||||||
|
|
@ -58,6 +62,7 @@ var Feature;
|
||||||
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
|
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
|
||||||
Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled";
|
Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled";
|
||||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||||
|
Feature["LanguageBaselineConfigEnabled"] = "language_baseline_config_enabled";
|
||||||
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||||
Feature["ScalingReservedRamEnabled"] = "scaling_reserved_ram_enabled";
|
Feature["ScalingReservedRamEnabled"] = "scaling_reserved_ram_enabled";
|
||||||
|
|
@ -94,6 +99,11 @@ exports.featureConfig = {
|
||||||
minimumVersion: "2.12.4",
|
minimumVersion: "2.12.4",
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
|
[Feature.LanguageBaselineConfigEnabled]: {
|
||||||
|
envVar: "CODEQL_ACTION_LANGUAGE_BASELINE_CONFIG",
|
||||||
|
minimumVersion: exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
[Feature.MlPoweredQueriesEnabled]: {
|
[Feature.MlPoweredQueriesEnabled]: {
|
||||||
envVar: "CODEQL_ML_POWERED_QUERIES",
|
envVar: "CODEQL_ML_POWERED_QUERIES",
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -16,6 +16,7 @@ import {
|
||||||
Feature,
|
Feature,
|
||||||
FeatureEnablement,
|
FeatureEnablement,
|
||||||
useCodeScanningConfigInCli,
|
useCodeScanningConfigInCli,
|
||||||
|
CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import { isTracedLanguage, Language } from "./languages";
|
import { isTracedLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
|
|
@ -574,6 +575,20 @@ export async function getCodeQLForCmd(
|
||||||
) {
|
) {
|
||||||
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
await features.getValue(Feature.LanguageBaselineConfigEnabled, this)
|
||||||
|
) {
|
||||||
|
extraArgs.push("--calculate-language-specific-baseline");
|
||||||
|
} else if (
|
||||||
|
await util.codeQlVersionAbove(
|
||||||
|
this,
|
||||||
|
CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
extraArgs.push("--no-calculate-language-specific-baseline");
|
||||||
|
}
|
||||||
|
|
||||||
await runTool(
|
await runTool(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ export const CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||||
*/
|
*/
|
||||||
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
|
||||||
|
*/
|
||||||
|
export const CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
|
||||||
|
|
||||||
export interface CodeQLDefaultVersionInfo {
|
export interface CodeQLDefaultVersionInfo {
|
||||||
cliVersion: string;
|
cliVersion: string;
|
||||||
tagName: string;
|
tagName: string;
|
||||||
|
|
@ -55,6 +60,7 @@ export enum Feature {
|
||||||
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
|
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
|
||||||
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
|
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
|
||||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||||
|
LanguageBaselineConfigEnabled = "language_baseline_config_enabled",
|
||||||
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
||||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||||
ScalingReservedRamEnabled = "scaling_reserved_ram_enabled",
|
ScalingReservedRamEnabled = "scaling_reserved_ram_enabled",
|
||||||
|
|
@ -95,6 +101,11 @@ export const featureConfig: Record<
|
||||||
minimumVersion: "2.12.4",
|
minimumVersion: "2.12.4",
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
|
[Feature.LanguageBaselineConfigEnabled]: {
|
||||||
|
envVar: "CODEQL_ACTION_LANGUAGE_BASELINE_CONFIG",
|
||||||
|
minimumVersion: CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
[Feature.MlPoweredQueriesEnabled]: {
|
[Feature.MlPoweredQueriesEnabled]: {
|
||||||
envVar: "CODEQL_ML_POWERED_QUERIES",
|
envVar: "CODEQL_ML_POWERED_QUERIES",
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue