Skip to content

Commit

Permalink
Merge pull request #1903 from github/henrymercer/sublanguage-file-cov…
Browse files Browse the repository at this point in the history
…erage

Enable sub-language file coverage behind a feature flag
  • Loading branch information
henrymercer authored Sep 26, 2023
2 parents e548601 + c95737b commit 4818fdd
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th

- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
- 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 4818fdd

Please sign in to comment.