Merge pull request #1834 from github/henrymercer/analysis-summary-v2-ff

Rename new analysis summary feature flag
This commit is contained in:
Henry Mercer 2023-08-14 10:57:25 +01:00 committed by GitHub
commit ac49314877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 28 deletions

2
lib/analyze.js generated
View file

@ -232,7 +232,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
} }
statusReport["event_reports"].push(perQueryAlertCountEventReport); statusReport["event_reports"].push(perQueryAlertCountEventReport);
} }
if (!(await features.getValue(feature_flags_1.Feature.NewAnalysisSummaryEnabled, codeql))) { if (!(await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, codeql))) {
await runPrintLinesOfCode(language); await runPrintLinesOfCode(language);
} }
} }

File diff suppressed because one or more lines are too long

4
lib/codeql.js generated
View file

@ -485,10 +485,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
else if (await util.codeQlVersionAbove(this, "2.12.4")) { else if (await util.codeQlVersionAbove(this, "2.12.4")) {
codeqlArgs.push("--no-sarif-include-diagnostics"); codeqlArgs.push("--no-sarif-include-diagnostics");
} }
if (await features.getValue(feature_flags_1.Feature.NewAnalysisSummaryEnabled, this)) { if (await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, this)) {
codeqlArgs.push("--new-analysis-summary"); codeqlArgs.push("--new-analysis-summary");
} }
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY)) { else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
codeqlArgs.push("--no-new-analysis-summary"); codeqlArgs.push("--no-new-analysis-summary");
} }
codeqlArgs.push(databasePath); codeqlArgs.push(databasePath);

File diff suppressed because one or more lines are too long

2
lib/codeql.test.js generated
View file

@ -714,7 +714,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion); sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.NewAnalysisSummaryEnabled] : []), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true));
t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`); t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`);
t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`); t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`);
}); });

File diff suppressed because one or more lines are too long

16
lib/feature-flags.js generated
View file

@ -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_NEW_ANALYSIS_SUMMARY = 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_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"));
@ -39,7 +39,7 @@ exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
/** /**
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries. * Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
*/ */
exports.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY = "2.14.0"; 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.
*/ */
@ -51,6 +51,7 @@ exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0";
*/ */
var Feature; var Feature;
(function (Feature) { (function (Feature) {
Feature["AnalysisSummaryV2Enabled"] = "analysis_summary_v2_enabled";
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled"; Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled"; Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled";
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled"; Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
@ -58,12 +59,16 @@ var Feature;
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["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled"; Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
Feature["NewAnalysisSummaryEnabled"] = "new_analysis_summary_enabled";
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled"; Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
Feature["ScalingReservedRamEnabled"] = "scaling_reserved_ram_enabled"; Feature["ScalingReservedRamEnabled"] = "scaling_reserved_ram_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 = {
[Feature.AnalysisSummaryV2Enabled]: {
envVar: "CODEQL_ACTION_ANALYSIS_SUMMARY_V2",
minimumVersion: exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2,
defaultValue: false,
},
[Feature.CodeqlJavaLombokEnabled]: { [Feature.CodeqlJavaLombokEnabled]: {
envVar: "CODEQL_JAVA_LOMBOK", envVar: "CODEQL_JAVA_LOMBOK",
minimumVersion: "2.14.0", minimumVersion: "2.14.0",
@ -94,11 +99,6 @@ exports.featureConfig = {
minimumVersion: undefined, minimumVersion: undefined,
defaultValue: false, defaultValue: false,
}, },
[Feature.NewAnalysisSummaryEnabled]: {
envVar: "CODEQL_ACTION_NEW_ANALYSIS_SUMMARY",
minimumVersion: exports.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY,
defaultValue: false,
},
[Feature.QaTelemetryEnabled]: { [Feature.QaTelemetryEnabled]: {
envVar: "CODEQL_ACTION_QA_TELEMETRY", envVar: "CODEQL_ACTION_QA_TELEMETRY",
minimumVersion: undefined, minimumVersion: undefined,

File diff suppressed because one or more lines are too long

View file

@ -389,7 +389,7 @@ export async function runQueries(
} }
if ( if (
!(await features.getValue(Feature.NewAnalysisSummaryEnabled, codeql)) !(await features.getValue(Feature.AnalysisSummaryV2Enabled, codeql))
) { ) {
await runPrintLinesOfCode(language); await runPrintLinesOfCode(language);
} }

View file

@ -1137,7 +1137,7 @@ for (const {
"-v", "-v",
"", "",
stubConfig, stubConfig,
createFeatures(featureEnabled ? [Feature.NewAnalysisSummaryEnabled] : []), createFeatures(featureEnabled ? [Feature.AnalysisSummaryV2Enabled] : []),
getRunnerLogger(true), getRunnerLogger(true),
); );
t.is( t.is(

View file

@ -11,7 +11,7 @@ import type { Config } from "./config-utils";
import { EnvVar } from "./environment"; import { EnvVar } from "./environment";
import { import {
CODEQL_VERSION_INTRA_LAYER_PARALLELISM, CODEQL_VERSION_INTRA_LAYER_PARALLELISM,
CODEQL_VERSION_NEW_ANALYSIS_SUMMARY, CODEQL_VERSION_ANALYSIS_SUMMARY_V2,
CodeQLDefaultVersionInfo, CodeQLDefaultVersionInfo,
Feature, Feature,
FeatureEnablement, FeatureEnablement,
@ -856,10 +856,10 @@ export async function getCodeQLForCmd(
} else if (await util.codeQlVersionAbove(this, "2.12.4")) { } else if (await util.codeQlVersionAbove(this, "2.12.4")) {
codeqlArgs.push("--no-sarif-include-diagnostics"); codeqlArgs.push("--no-sarif-include-diagnostics");
} }
if (await features.getValue(Feature.NewAnalysisSummaryEnabled, this)) { if (await features.getValue(Feature.AnalysisSummaryV2Enabled, this)) {
codeqlArgs.push("--new-analysis-summary"); codeqlArgs.push("--new-analysis-summary");
} else if ( } else if (
await util.codeQlVersionAbove(this, CODEQL_VERSION_NEW_ANALYSIS_SUMMARY) await util.codeQlVersionAbove(this, CODEQL_VERSION_ANALYSIS_SUMMARY_V2)
) { ) {
codeqlArgs.push("--no-new-analysis-summary"); codeqlArgs.push("--no-new-analysis-summary");
} }

View file

@ -21,7 +21,7 @@ export const CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
/** /**
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries. * Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
*/ */
export const CODEQL_VERSION_NEW_ANALYSIS_SUMMARY = "2.14.0"; export const 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.
@ -48,6 +48,7 @@ export interface FeatureEnablement {
* Each value of this enum should end with `_enabled`. * Each value of this enum should end with `_enabled`.
*/ */
export enum Feature { export enum Feature {
AnalysisSummaryV2Enabled = "analysis_summary_v2_enabled",
CliConfigFileEnabled = "cli_config_file_enabled", CliConfigFileEnabled = "cli_config_file_enabled",
CodeqlJavaLombokEnabled = "codeql_java_lombok_enabled", CodeqlJavaLombokEnabled = "codeql_java_lombok_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled", DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
@ -55,7 +56,6 @@ export enum Feature {
EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled", EvaluatorIntraLayerParallelismEnabled = "evaluator_intra_layer_parallelism_enabled",
ExportDiagnosticsEnabled = "export_diagnostics_enabled", ExportDiagnosticsEnabled = "export_diagnostics_enabled",
MlPoweredQueriesEnabled = "ml_powered_queries_enabled", MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
NewAnalysisSummaryEnabled = "new_analysis_summary_enabled",
QaTelemetryEnabled = "qa_telemetry_enabled", QaTelemetryEnabled = "qa_telemetry_enabled",
ScalingReservedRamEnabled = "scaling_reserved_ram_enabled", ScalingReservedRamEnabled = "scaling_reserved_ram_enabled",
UploadFailedSarifEnabled = "upload_failed_sarif_enabled", UploadFailedSarifEnabled = "upload_failed_sarif_enabled",
@ -65,6 +65,11 @@ export const featureConfig: Record<
Feature, Feature,
{ envVar: string; minimumVersion: string | undefined; defaultValue: boolean } { envVar: string; minimumVersion: string | undefined; defaultValue: boolean }
> = { > = {
[Feature.AnalysisSummaryV2Enabled]: {
envVar: "CODEQL_ACTION_ANALYSIS_SUMMARY_V2",
minimumVersion: CODEQL_VERSION_ANALYSIS_SUMMARY_V2,
defaultValue: false,
},
[Feature.CodeqlJavaLombokEnabled]: { [Feature.CodeqlJavaLombokEnabled]: {
envVar: "CODEQL_JAVA_LOMBOK", envVar: "CODEQL_JAVA_LOMBOK",
minimumVersion: "2.14.0", minimumVersion: "2.14.0",
@ -95,11 +100,6 @@ export const featureConfig: Record<
minimumVersion: undefined, minimumVersion: undefined,
defaultValue: false, defaultValue: false,
}, },
[Feature.NewAnalysisSummaryEnabled]: {
envVar: "CODEQL_ACTION_NEW_ANALYSIS_SUMMARY",
minimumVersion: CODEQL_VERSION_NEW_ANALYSIS_SUMMARY,
defaultValue: false,
},
[Feature.QaTelemetryEnabled]: { [Feature.QaTelemetryEnabled]: {
envVar: "CODEQL_ACTION_QA_TELEMETRY", envVar: "CODEQL_ACTION_QA_TELEMETRY",
minimumVersion: undefined, minimumVersion: undefined,