Skip to content

Commit 34f97d7

Browse files
authored
Merge pull request #1944 from github/henrymercer/sublanguage-file-coverage-fixes
Enable sub-language file coverage during interpretation and update PR check
2 parents b584cf8 + 346d5c4 commit 34f97d7

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

.github/workflows/__export-file-baseline-information.yml

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/export-file-baseline-information.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: "Export file baseline information"
22
description: "Tests that file baseline information is exported when the feature is enabled"
33
versions: ["nightly-latest"]
4+
env:
5+
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
46
steps:
57
- uses: ./../action/init
68
id: init
79
with:
810
languages: javascript
911
tools: ${{ steps.prepare-test.outputs.tools-url }}
10-
env:
11-
CODEQL_FILE_BASELINE_INFORMATION: true
1212
- uses: ./../action/.github/actions/setup-swift
1313
with:
1414
codeql-path: ${{ steps.init.outputs.codeql-path }}
@@ -18,8 +18,6 @@ steps:
1818
- uses: ./../action/analyze
1919
with:
2020
output: "${{ runner.temp }}/results"
21-
env:
22-
CODEQL_FILE_BASELINE_INFORMATION: true
2321
- name: Upload SARIF
2422
uses: actions/upload-artifact@v3
2523
with:
@@ -30,13 +28,13 @@ steps:
3028
shell: bash
3129
run: |
3230
cd "$RUNNER_TEMP/results"
33-
expected_baseline_languages="cpp cs go java js py rb"
31+
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
3432
if [[ $RUNNER_OS != "Windows" ]]; then
3533
expected_baseline_languages+=" swift"
3634
fi
3735
3836
for lang in ${expected_baseline_languages}; do
39-
rule_name="${lang}/baseline/expected-extracted-files"
37+
rule_name="cli/expected-extracted-files/${lang}"
4038
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
4139
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
4240
if [[ "${found_notification}" != "true" ]]; then

src/codeql.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,18 @@ export async function getCodeQLForCmd(
908908
) {
909909
codeqlArgs.push("--sarif-add-baseline-file-info");
910910
}
911+
if (
912+
await features.getValue(Feature.SublanguageFileCoverageEnabled, this)
913+
) {
914+
codeqlArgs.push("--sublanguage-file-coverage");
915+
} else if (
916+
await util.codeQlVersionAbove(
917+
this,
918+
CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
919+
)
920+
) {
921+
codeqlArgs.push("--no-sublanguage-file-coverage");
922+
}
911923
if (shouldExportDiagnostics) {
912924
codeqlArgs.push("--sarif-include-diagnostics");
913925
} else if (await util.codeQlVersionAbove(this, "2.12.4")) {

0 commit comments

Comments
 (0)