Skip to content

Commit

Permalink
Use .push rather than .concat
Browse files Browse the repository at this point in the history
  • Loading branch information
Angela P Wen committed Sep 11, 2024
1 parent 82ce313 commit d4bfd40
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 5 additions & 5 deletions lib/debug-artifacts.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/debug-artifacts.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions src/debug-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function uploadAllAvailableDebugArtifacts(
config: Config,
logger: Logger,
) {
let filesToUpload: string[] = [];
const filesToUpload: string[] = [];

const analyzeActionOutputDir = process.env[EnvVar.SARIF_RESULTS_OUTPUT_DIR];
for (const lang of config.languages) {
Expand All @@ -46,15 +46,15 @@ export async function uploadAllAvailableDebugArtifacts(
`${lang}.sarif`,
);
fs.renameSync(sarifFile, sarifInDbLocation);
filesToUpload = filesToUpload.concat(sarifInDbLocation);
filesToUpload.push(sarifInDbLocation);
}
}

// Add any log files
const databaseDirectory = getCodeQLDatabasePath(config, lang);
const logsDirectory = path.resolve(databaseDirectory, "log");
if (doesDirectoryExist(logsDirectory)) {
filesToUpload = filesToUpload.concat(listFolder(logsDirectory));
filesToUpload.push(...listFolder(logsDirectory));
}

// Multilanguage tracing: there are additional logs in the root of the cluster
Expand All @@ -63,9 +63,7 @@ export async function uploadAllAvailableDebugArtifacts(
"log",
);
if (doesDirectoryExist(multiLanguageTracingLogsDirectory)) {
filesToUpload = filesToUpload.concat(
listFolder(multiLanguageTracingLogsDirectory),
);
filesToUpload.push(...listFolder(multiLanguageTracingLogsDirectory));
}

// Add database bundle
Expand All @@ -75,7 +73,7 @@ export async function uploadAllAvailableDebugArtifacts(
} else {
databaseBundlePath = await createDatabaseBundleCli(config, lang);
}
filesToUpload = filesToUpload.concat(databaseBundlePath);
filesToUpload.push(databaseBundlePath);
}

await uploadDebugArtifacts(
Expand Down

0 comments on commit d4bfd40

Please sign in to comment.