Skip to content

Commit

Permalink
Merge pull request #876 from uhafner/no-newline-start-end
Browse files Browse the repository at this point in the history
Add CheckStyle checks to ensure no empty lines
  • Loading branch information
uhafner authored Dec 8, 2023
2 parents b4e293a + 4423cb7 commit 7da021a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
8 changes: 8 additions & 0 deletions etc/checkstyle-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="RegexpMultiline">
<property name="format" value="\{\s*\R\s*\R"/>
<property name="message" value="No empty lines after opening curly braces allowed" />
</module>
<module name="RegexpMultiline">
<property name="format" value="\R\s*\R\s*\}"/>
<property name="message" value="No empty lines before closing curly braces allowed" />
</module>
<module name="TreeWalker">
<module name="SuppressWarningsHolder" />

Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/hm/hafner/util/Ensure.java
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ public void isInstanceOf(final Class<?> type, final String explanation, final Ob
if (!type.isInstance(value)) {

Check warning on line 653 in src/main/java/edu/hm/hafner/util/Ensure.java

View workflow job for this annotation

GitHub Actions / Grading Badges

Partially covered line

Line 653 is only partially covered, one branch is missing
throwException(explanation, args);
}

}

Check warning on line 656 in src/main/java/edu/hm/hafner/util/Ensure.java

View workflow job for this annotation

GitHub Actions / Grading Badges

Not covered lines

Lines 654-656 are not covered by tests
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/hm/hafner/util/PathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public String getRelativePath(final Path base, final Path path) {
return makeUnixPath(normalizedBase.relativize(normalize(path)).toString());
}
return makeUnixPath(normalizedBase.relativize(normalize(base.resolve(path))).toString());

}
catch (IOException | IllegalArgumentException ignored) {
// ignore and return the path as such
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/edu/hm/hafner/util/ArchitectureRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public boolean test(final JavaCall<?> input) {
private boolean isVisibleForTesting(final CanBeAnnotated target) {
return target.isAnnotatedWith(VisibleForTesting.class);
}

}

/**
Expand Down Expand Up @@ -200,7 +199,6 @@ public boolean test(final JavaConstructorCall javaConstructorCall) {
private boolean isPermittedException(final JavaClass owner) {
return allowedExceptions.stream().anyMatch(owner::isAssignableTo);
}

}

private static class ShouldBeProtectedCondition extends ArchCondition<JavaMethod> {
Expand Down

0 comments on commit 7da021a

Please sign in to comment.