@@ -28,13 +28,16 @@ def handle_output(self, diff_report: Diff) -> None:
2828 self .save_sbom_file (diff_report , self .config .sbom_file )
2929
3030 def return_exit_code (self , diff_report : Diff ) -> int :
31- if not self .report_pass (diff_report ) and not self .config .disable_blocking :
31+ if self .config .disable_blocking :
32+ return 0
33+
34+ if not self .report_pass (diff_report ):
3235 return 1
33- elif len (diff_report .new_alerts ) > 0 and not self .config .disable_blocking :
36+
37+ if len (diff_report .new_alerts ) > 0 :
3438 # 5 means warning alerts but no blocking alerts
3539 return 5
36- else :
37- return 0
40+ return 0
3841
3942 def output_console_comments (self , diff_report : Diff , sbom_file_name : Optional [str ] = None ) -> None :
4043 """Outputs formatted console comments"""
@@ -49,6 +52,7 @@ def output_console_comments(self, diff_report: Diff, sbom_file_name: Optional[st
4952 def output_console_json (self , diff_report : Diff , sbom_file_name : Optional [str ] = None ) -> None :
5053 """Outputs JSON formatted results"""
5154 console_security_comment = Messages .create_security_comment_json (diff_report )
55+ self .save_sbom_file (diff_report , sbom_file_name )
5256 self .logger .info (json .dumps (console_security_comment ))
5357
5458 def output_console_sarif (self , diff_report : Diff , sbom_file_name : Optional [str ] = None ) -> None :
@@ -58,9 +62,9 @@ def output_console_sarif(self, diff_report: Diff, sbom_file_name: Optional[str]
5862 if diff_report .id != "NO_DIFF_RAN" :
5963 # Generate the SARIF structure using Messages
6064 console_security_comment = Messages .create_security_comment_sarif (diff_report )
61-
65+ self . save_sbom_file ( diff_report , sbom_file_name )
6266 # Print the SARIF output to the console in JSON format
63- self . logger . info (json .dumps (console_security_comment , indent = 2 ))
67+ print (json .dumps (console_security_comment , indent = 2 ))
6468
6569 def report_pass (self , diff_report : Diff ) -> bool :
6670 """Determines if the report passes security checks"""
0 commit comments