diff --git a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/CheckList.java b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/CheckList.java index ed7224cf..34bbd829 100644 --- a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/CheckList.java +++ b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/CheckList.java @@ -110,15 +110,4 @@ public static List> getChecks() { getFixers() { return Map.of(FormattingCheck.class, List.of(FormattingFixer.class)); } - - /** - * Get {@link MagikCheck}s which are disabled by default. - * - * @return List of {@link MagikCheck}s. - */ - public static List> getDisabledByDefaultChecks() { - return getChecks().stream() - .filter(checkClass -> checkClass.getAnnotation(DisabledByDefault.class) != null) - .toList(); - } } diff --git a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/MagikChecksConfiguration.java b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/MagikChecksConfiguration.java index 7e1c3041..ea20b9c4 100644 --- a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/MagikChecksConfiguration.java +++ b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/MagikChecksConfiguration.java @@ -49,9 +49,15 @@ public List getAllChecks() { for (final Class checkClass : this.checkClasses) { final String checkKey = MagikChecksConfiguration.checkKey(checkClass); - final boolean checkEnabled = - enableds.contains(checkKey) - || !disableds.contains(checkKey) && !disableds.contains("all"); + final boolean checkEnabled; + if (enableds.contains(checkKey)) { + checkEnabled = true; + } else if (disableds.contains(checkKey) || disableds.contains("all")) { + checkEnabled = false; + } else { + // No explicit configuration, use default state + checkEnabled = checkClass.getAnnotation(DisabledByDefault.class) == null; + } // Gather parameters from MagikCheck, value from config. final Set parameters = diff --git a/magik-typed-checks/src/main/java/nl/ramsolutions/sw/magik/typedchecks/CheckList.java b/magik-typed-checks/src/main/java/nl/ramsolutions/sw/magik/typedchecks/CheckList.java index 3e50fbc7..157e6e11 100644 --- a/magik-typed-checks/src/main/java/nl/ramsolutions/sw/magik/typedchecks/CheckList.java +++ b/magik-typed-checks/src/main/java/nl/ramsolutions/sw/magik/typedchecks/CheckList.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.Map; -import nl.ramsolutions.sw.magik.checks.DisabledByDefault; import nl.ramsolutions.sw.magik.checks.MagikCheck; import nl.ramsolutions.sw.magik.checks.checks.TypeDocCheck; import nl.ramsolutions.sw.magik.typedchecks.checks.ConditionalExpressionIsFalseTypedCheck; @@ -58,15 +57,4 @@ public static List> getChecks() { return Map.of( TypeDocCheck.class, List.of(TypeDocParameterFixer.class, TypeDocReturnTypeFixer.class)); } - - /** - * Get {@link MagikCheck}s which are disabled by default. - * - * @return List of {@link MagikCheck}s. - */ - public static List> getDisabledByDefaultChecks() { - return getChecks().stream() - .filter(checkClass -> checkClass.getAnnotation(DisabledByDefault.class) != null) - .toList(); - } }