Skip to content

Commit e28ecb0

Browse files
committed
Fix addSarifExtension and add tests
1 parent 1746aed commit e28ecb0

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

lib/analyze-action.js

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

src/analyze.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
runQueries,
1111
defaultSuites,
1212
resolveQuerySuiteAlias,
13+
addSarifExtension,
1314
} from "./analyze";
1415
import { createStubCodeQL } from "./codeql";
1516
import { Feature } from "./feature-flags";
@@ -23,6 +24,7 @@ import {
2324
} from "./testing-utils";
2425
import * as uploadLib from "./upload-lib";
2526
import * as util from "./util";
27+
import { CodeQuality, CodeScanning } from "./analyses";
2628

2729
setupTests(test);
2830

@@ -348,3 +350,13 @@ test("resolveQuerySuiteAlias", (t) => {
348350
t.deepEqual(resolveQuerySuiteAlias(KnownLanguage.go, name), name);
349351
}
350352
});
353+
354+
test("addSarifExtension", (t) => {
355+
for (const language of Object.values(KnownLanguage)) {
356+
t.deepEqual(addSarifExtension(CodeScanning, language), `${language}.sarif`);
357+
t.deepEqual(
358+
addSarifExtension(CodeQuality, language),
359+
`${language}.quality.sarif`,
360+
);
361+
}
362+
});

src/analyze.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ export function addSarifExtension(
615615
analysis: analyses.AnalysisConfig,
616616
base: string,
617617
): string {
618-
return `${base}.${analysis.sarifExtension}`;
618+
return `${base}${analysis.sarifExtension}`;
619619
}
620620

621621
// Runs queries and creates sarif files in the given folder

0 commit comments

Comments
 (0)