Specify reason for skipping SARIF upload in logs

This commit is contained in:
Paolo Tranquilli
2025-10-06 15:39:29 +02:00
parent 11e4034414
commit 680b07003d
9 changed files with 75 additions and 31 deletions
+9 -3
View File
@@ -771,10 +771,16 @@ export function isInTestMode(): boolean {
}
/**
* Returns whether we specifically want to skip uploading SARIF files.
* Returns whether we specifically want to skip uploading SARIF files, and if so, why.
*/
export function shouldSkipSarifUpload(): boolean {
return isInTestMode() || process.env[EnvVar.SKIP_SARIF_UPLOAD] === "true";
export function getSarifUploadSkipReason(): string | null {
if (isInTestMode()) {
return `SARIF upload is disabled via ${EnvVar.TEST_MODE}`;
}
if (process.env[EnvVar.SKIP_SARIF_UPLOAD] === "true") {
return `SARIF upload is disabled via ${EnvVar.SKIP_SARIF_UPLOAD}`;
}
return null;
}
/**