From 4423cb7e261eec88b81aece622786f45d9a11a12 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Fri, 8 Dec 2023 16:59:25 +0100 Subject: [PATCH] Add CheckStyle checks to ensure no empty lines. - There should be no empty line right after an opening curly brace. - There should be no empty line right before a closing curly brace. --- etc/checkstyle-configuration.xml | 8 ++++++++ src/main/java/edu/hm/hafner/util/Ensure.java | 1 - src/main/java/edu/hm/hafner/util/PathUtil.java | 1 - src/test/java/edu/hm/hafner/util/ArchitectureRules.java | 2 -- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/etc/checkstyle-configuration.xml b/etc/checkstyle-configuration.xml index 454521a1..c7ab6cd8 100644 --- a/etc/checkstyle-configuration.xml +++ b/etc/checkstyle-configuration.xml @@ -8,6 +8,14 @@ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + + + + + + + + diff --git a/src/main/java/edu/hm/hafner/util/Ensure.java b/src/main/java/edu/hm/hafner/util/Ensure.java index 22c1b6d8..ae0bb43b 100644 --- a/src/main/java/edu/hm/hafner/util/Ensure.java +++ b/src/main/java/edu/hm/hafner/util/Ensure.java @@ -653,7 +653,6 @@ public void isInstanceOf(final Class type, final String explanation, final Ob if (!type.isInstance(value)) { throwException(explanation, args); } - } } diff --git a/src/main/java/edu/hm/hafner/util/PathUtil.java b/src/main/java/edu/hm/hafner/util/PathUtil.java index 26d8a507..8e7fb007 100644 --- a/src/main/java/edu/hm/hafner/util/PathUtil.java +++ b/src/main/java/edu/hm/hafner/util/PathUtil.java @@ -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 diff --git a/src/test/java/edu/hm/hafner/util/ArchitectureRules.java b/src/test/java/edu/hm/hafner/util/ArchitectureRules.java index 61e4099e..3ea127df 100644 --- a/src/test/java/edu/hm/hafner/util/ArchitectureRules.java +++ b/src/test/java/edu/hm/hafner/util/ArchitectureRules.java @@ -165,7 +165,6 @@ public boolean test(final JavaCall input) { private boolean isVisibleForTesting(final CanBeAnnotated target) { return target.isAnnotatedWith(VisibleForTesting.class); } - } /** @@ -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 {