Skip to content

Commit ad086e4

Browse files
committed
Use path.extname for some extension checks
1 parent 93711d3 commit ad086e4

File tree

10 files changed

+1584
-1574
lines changed

10 files changed

+1584
-1574
lines changed

lib/analyze-action-post.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.

lib/analyze-action.js

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

lib/init-action-post.js

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

lib/init-action.js

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

lib/upload-lib.js

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

lib/upload-sarif-action-post.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.

lib/upload-sarif-action.js

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

src/analyze.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ test("resolveQuerySuiteAlias", (t) => {
334334
for (const suite of defaultSuites) {
335335
const resolved = resolveQuerySuiteAlias(KnownLanguage.go, suite);
336336
t.assert(
337-
resolved.endsWith(".qls"),
337+
path.extname(resolved) === ".qls",
338338
"Resolved default suite doesn't end in .qls",
339339
);
340340
t.assert(

src/debug-artifacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function uploadCombinedSarifArtifacts(
5959
for (const outputDir of outputDirs) {
6060
const sarifFiles = fs
6161
.readdirSync(path.resolve(baseTempDir, outputDir))
62-
.filter((f) => f.endsWith(".sarif"));
62+
.filter((f) => path.extname(f) === ".sarif");
6363

6464
for (const sarifFile of sarifFiles) {
6565
toUpload.push(path.resolve(baseTempDir, outputDir, sarifFile));

src/upload-lib.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,9 @@ export async function getGroupedSarifFilePaths(
480480
const results = {};
481481

482482
if (stats.isDirectory()) {
483-
let sarifFiles = findSarifFilesInDir(sarifPath, (name) =>
484-
name.endsWith(".sarif"),
483+
let sarifFiles = findSarifFilesInDir(
484+
sarifPath,
485+
(name) => path.extname(name) === ".sarif",
485486
);
486487
logger.debug(
487488
`Found the following .sarif files in ${sarifPath}: ${sarifFiles.join(", ")}`,

0 commit comments

Comments
 (0)