Skip to content

Commit 603a572

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

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
@@ -5,11 +5,13 @@ import test from "ava";
55
import * as sinon from "sinon";
66

77
import * as actionsUtil from "./actions-util";
8+
import { CodeQuality, CodeScanning } from "./analyses";
89
import {
910
exportedForTesting,
1011
runQueries,
1112
defaultSuites,
1213
resolveQuerySuiteAlias,
14+
addSarifExtension,
1315
} from "./analyze";
1416
import { createStubCodeQL } from "./codeql";
1517
import { Feature } from "./feature-flags";
@@ -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)