diff --git a/checkstyle.xml b/checkstyle.xml index 56ab44e3c622..ec22ce48e21b 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -20,5 +20,6 @@ + diff --git a/src/main/java/de/tum/in/www1/artemis/service/TextBlockService.java b/src/main/java/de/tum/in/www1/artemis/service/TextBlockService.java index b8408a5530c1..19b4dc50d31c 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/TextBlockService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/TextBlockService.java @@ -73,8 +73,9 @@ public Set splitSubmissionIntoBlocks(TextSubmission submission) { final int startIndex = start + offset; final int endIndex = startIndex + lineOrSentenceTrimed.length(); start = start + lineOrSentence.length() + LINE_SEPARATOR_LENGTH; - if (startIndex == endIndex || lineOrSentence.isBlank()) + if (startIndex == endIndex || lineOrSentence.isBlank()) { continue; // Do *not* define a text block for an empty line. + } final TextBlock textBlock = new TextBlock().text(lineOrSentenceTrimed).startIndex(startIndex).endIndex(endIndex).submission(submission).automatic(); textBlock.computeId(); diff --git a/src/main/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizExerciseCache.java b/src/main/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizExerciseCache.java index 4ae599da59b8..ba37fd740bf2 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizExerciseCache.java +++ b/src/main/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizExerciseCache.java @@ -78,10 +78,12 @@ public final int hashCode() { @Override public final boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (!(obj instanceof QuizExerciseCache)) + } + if (!(obj instanceof QuizExerciseCache)) { return false; + } return Objects.equals(exerciseId, ((QuizExerciseCache) obj).exerciseId); } diff --git a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamLiveEventDTO.java b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamLiveEventDTO.java index cac6c288546b..2426e68f296c 100644 --- a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamLiveEventDTO.java +++ b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamLiveEventDTO.java @@ -52,10 +52,12 @@ public void setCreatedDate(Instant createdDate) { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; + } ExamLiveEventDTO that = (ExamLiveEventDTO) o; return Objects.equals(id, that.id) && Objects.equals(createdBy, that.createdBy) && Objects.equals(createdDate, that.createdDate); } diff --git a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamWideAnnouncementEventDTO.java b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamWideAnnouncementEventDTO.java index 519a01ebbe7a..d223a42e26e4 100644 --- a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamWideAnnouncementEventDTO.java +++ b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/ExamWideAnnouncementEventDTO.java @@ -19,12 +19,15 @@ public void setText(String text) { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; - if (!super.equals(o)) + } + if (!super.equals(o)) { return false; + } ExamWideAnnouncementEventDTO that = (ExamWideAnnouncementEventDTO) o; return Objects.equals(text, that.text); } diff --git a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/WorkingTimeUpdateEventDTO.java b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/WorkingTimeUpdateEventDTO.java index 2abfd0b1032d..4b812ce911df 100644 --- a/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/WorkingTimeUpdateEventDTO.java +++ b/src/main/java/de/tum/in/www1/artemis/web/rest/dto/examevent/WorkingTimeUpdateEventDTO.java @@ -39,12 +39,15 @@ public void setCourseWide(boolean courseWide) { @Override public boolean equals(Object o) { - if (this == o) + if (this == o) { return true; - if (o == null || getClass() != o.getClass()) + } + if (o == null || getClass() != o.getClass()) { return false; - if (!super.equals(o)) + } + if (!super.equals(o)) { return false; + } WorkingTimeUpdateEventDTO that = (WorkingTimeUpdateEventDTO) o; return newWorkingTime == that.newWorkingTime && oldWorkingTime == that.oldWorkingTime && courseWide == that.courseWide; } diff --git a/src/main/resources/templates/java/test/staticCodeAnalysisConfig/checkstyle-configuration.xml b/src/main/resources/templates/java/test/staticCodeAnalysisConfig/checkstyle-configuration.xml index 8f5e762b16f4..b5d640a57efb 100644 --- a/src/main/resources/templates/java/test/staticCodeAnalysisConfig/checkstyle-configuration.xml +++ b/src/main/resources/templates/java/test/staticCodeAnalysisConfig/checkstyle-configuration.xml @@ -23,40 +23,43 @@ - + - + - + - + - + - + + + - + + @@ -65,7 +68,7 @@ - + @@ -74,7 +77,7 @@ - + @@ -87,7 +90,7 @@ - + @@ -99,7 +102,7 @@ - + @@ -107,13 +110,9 @@ - - - - - + @@ -126,12 +125,12 @@ - + - + @@ -139,7 +138,7 @@ - + @@ -156,7 +155,7 @@ - + @@ -164,7 +163,7 @@ - + diff --git a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTemplateIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTemplateIntegrationTest.java index ea78546ada41..4d7302e4ce97 100644 --- a/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTemplateIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/exercise/programmingexercise/ProgrammingExerciseTemplateIntegrationTest.java @@ -84,8 +84,9 @@ static void detectMavenHome() { String m2Home = System.getenv("M2_HOME"); String mavenHome = System.getProperty("maven.home"); - if (m2Home != null || mavenHome != null) + if (m2Home != null || mavenHome != null) { return; + } try { String mvnExecutable = Os.isFamily(Os.FAMILY_WINDOWS) ? "mvn.cmd" : "mvn";