Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable sub-language file coverage behind a feature flag #1903

Merged
merged 2 commits into from Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
## [UNRELEASED]

- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)

## 2.21.8 - 19 Sep 2023
Expand Down
6 changes: 6 additions & 0 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion lib/feature-flags.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/feature-flags.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/codeql.ts
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
[
Expand Down
11 changes: 11 additions & 0 deletions src/feature-flags.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
}

Expand Down Expand Up @@ -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",
Expand Down