Skip to content

Commit

Permalink
PA-12431 logging (#10)
Browse files Browse the repository at this point in the history
* PA-12431 logging

* c

* c
  • Loading branch information
SOOS-GSteen committed Dec 26, 2023
1 parent 2ed0ebc commit f8b9e2f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@soos-io/soos-sast",
"version": "0.1.17",
"version": "0.1.18",
"description": "SOOS Static Application Security Testing (SAST) scanning support.",
"main": "bin/index.js",
"scripts": {
Expand All @@ -27,7 +27,7 @@
},
"homepage": "https://github.com/soos-io/soos-sast#readme",
"dependencies": {
"@soos-io/api-client": "0.2.24",
"@soos-io/api-client": "0.2.26",
"argparse": "^2.0.1",
"glob": "^10.3.10",
"tslib": "^2.6.2"
Expand Down
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
ScanType,
soosLogger,
} from "@soos-io/api-client";
import { obfuscateProperties, getAnalysisExitCode } from "@soos-io/api-client/dist/utilities";
import {
obfuscateProperties,
getAnalysisExitCodeWithMessage,
} from "@soos-io/api-client/dist/utilities";
import { exit } from "process";
import { version } from "../package.json";
import AnalysisService from "@soos-io/api-client/dist/services/AnalysisService";
Expand Down Expand Up @@ -149,13 +152,13 @@ class SOOSSASTAnalysis {
scanType,
});

const exitCode = getAnalysisExitCode(
const exitCodeWithMessage = getAnalysisExitCodeWithMessage(
scanStatus,
this.args.integrationName,
this.args.onFailure,
);
soosLogger.debug(`Exiting with code ${exitCode}`);
exit(exitCode);
soosLogger.always(`${exitCodeWithMessage.message} - exit ${exitCodeWithMessage.exitCode}`);
exit(exitCodeWithMessage.exitCode);
} catch (error) {
if (projectHash && branchHash && analysisId)
await soosAnalysisService.updateScanStatus({
Expand All @@ -169,6 +172,7 @@ class SOOSSASTAnalysis {
scanStatusUrl,
});
soosLogger.error(error);
soosLogger.always(`${error} - exit 1`);
exit(1);
}
}
Expand All @@ -193,6 +197,7 @@ class SOOSSASTAnalysis {
await soosSASTAnalysis.runAnalysis();
} catch (error) {
soosLogger.error(`Error on createAndRun: ${error}`);
soosLogger.always(`Error on createAndRun: ${error} - exit 1`);
exit(1);
}
}
Expand Down

0 comments on commit f8b9e2f

Please sign in to comment.