diff --git a/helpers/Dojo/AssignmentValidator.ts b/helpers/Dojo/AssignmentValidator.ts index a7c783b5567eb65699816fb39c60a406bee00e60..c6716fbb5055163d301516f36a8befbdad5e31a6 100644 --- a/helpers/Dojo/AssignmentValidator.ts +++ b/helpers/Dojo/AssignmentValidator.ts @@ -314,12 +314,17 @@ class AssignmentValidator { const runSuccess = SonarAnalyzer.runAnalysis(this.assignment.sonarKey, this.assignment.language, this.assignmentFile.buildLine); if ( runSuccess ) { - this.emitError(`Sonar gate failed`, 'Sonar analysis failure', AssignmentCheckerError.SONAR_ANALYSIS_FAILED); - throw new Error(); + if ( !this.assignment.allowSonarFailure ) { + this.emitError(`Sonar gate failed`, 'Sonar analysis failure', AssignmentCheckerError.SONAR_ANALYSIS_FAILED); + return; + } else { + this.endSubStep('Sonar gate failed, you should check the sonar project', false); + } + } else { + this.endSubStep('Sonar gate passed', false); } - this.endSubStep('Sonar gate passed', false); - this.endStep('Sonar analysis success', false); + this.endStep('Sonar analysis finished', false); } } diff --git a/models/Assignment.ts b/models/Assignment.ts index 6a24b321547bc6b20d00be1be06e46d2c74ec0f8..9a9a6e86afc76faea696c09787d05f7d635971a1 100644 --- a/models/Assignment.ts +++ b/models/Assignment.ts @@ -13,6 +13,7 @@ interface Assignment { gitlabLastInfoDate: string; published: boolean; useSonar: boolean; + allowSonarFailure: boolean; sonarKey: string; sonarCreationInfo: SonarProjectCreation; language: Language;