From 8957b25987e79e6f8a1ac4188525daea0b35d604 Mon Sep 17 00:00:00 2001 From: Joel von der Weid <joel.von-der-weid@hesge.ch> Date: Wed, 3 Jul 2024 09:49:55 +0200 Subject: [PATCH] Add allowSonarFailure --- helpers/Dojo/AssignmentValidator.ts | 13 +++++++++---- models/Assignment.ts | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/helpers/Dojo/AssignmentValidator.ts b/helpers/Dojo/AssignmentValidator.ts index a22d9f6..f9604ab 100644 --- a/helpers/Dojo/AssignmentValidator.ts +++ b/helpers/Dojo/AssignmentValidator.ts @@ -301,12 +301,17 @@ class AssignmentValidator { const runSuccess = SonarAnalyzer.runAnalysis(assignment.sonarKey, assignment.language, assignmentFile.buildLine); if ( runSuccess ) { - this.emitError(`Sonar gate failed`, 'Sonar analysis failure', AssignmentCheckerError.SONAR_ANALYSIS_FAILED); - return; + if ( !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 843b6b4..55dd7f1 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; -- GitLab