@@ -57,24 +57,49 @@ func AddJasScannersTasks(params JasRunnerParams) (generalError error) {
5757 if params .ApplicableScanType == applicability .ApplicabilityScannerType || params .SecretsScanType == secrets .SecretsScannerType {
5858 runAllScanners = true
5959 }
60+
61+ var errorsCollection error
6062 if generalError = addJasScanTaskForModuleIfNeeded (params , utils .ContextualAnalysisScan , runContextualScan (& params )); generalError != nil {
61- return
63+ if ! params .AllowPartialResults {
64+ return
65+ }
66+ // If allow_partial_results enabled we collect all errors and return all at the end of the function.
67+ errorsCollection = errors .Join (errorsCollection , generalError )
6268 }
6369 if params .ThirdPartyApplicabilityScan {
6470 // Don't execute other scanners when scanning third party dependencies.
6571 return
6672 }
73+
6774 if generalError = addJasScanTaskForModuleIfNeeded (params , utils .SecretsScan , runSecretsScan (& params )); generalError != nil {
68- return
75+ if ! params .AllowPartialResults {
76+ return
77+ }
78+ // If allow_partial_results enabled we collect all errors and return all at the end of the function.
79+ errorsCollection = errors .Join (errorsCollection , generalError )
6980 }
81+
7082 if ! runAllScanners {
7183 // Binary scan only supports secrets and contextual scans.
7284 return
7385 }
86+
7487 if generalError = addJasScanTaskForModuleIfNeeded (params , utils .IacScan , runIacScan (& params )); generalError != nil {
75- return
88+ if ! params .AllowPartialResults {
89+ return
90+ }
91+ // If allow_partial_results enabled we collect all errors and return all at the end of the function.
92+ errorsCollection = errors .Join (errorsCollection , generalError )
93+ }
94+
95+ if generalError = addJasScanTaskForModuleIfNeeded (params , utils .SastScan , runSastScan (& params )); generalError != nil {
96+ if ! params .AllowPartialResults {
97+ return
98+ }
99+ // If allow_partial_results enabled we collect all errors and return all at the end of the function.
100+ errorsCollection = errors .Join (errorsCollection , generalError )
76101 }
77- return addJasScanTaskForModuleIfNeeded ( params , utils . SastScan , runSastScan ( & params ))
102+ return errorsCollection
78103}
79104
80105func addJasScanTaskForModuleIfNeeded (params JasRunnerParams , subScan utils.SubScanType , task parallel.TaskFunc ) (generalError error ) {
0 commit comments