Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-file-without-package-statemen…
Browse files Browse the repository at this point in the history
…t-check
  • Loading branch information
sebastiaanspeck authored Nov 18, 2024
2 parents 30529f1 + 9369da8 commit a354a19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: DavidAnson/markdownlint-cli2-action@v17
- uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: '**/*.md'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,4 @@ public static List<Class<? extends MagikCheck>> 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<Class<? extends MagikCheck>> getDisabledByDefaultChecks() {
return getChecks().stream()
.filter(checkClass -> checkClass.getAnnotation(DisabledByDefault.class) != null)
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ public List<MagikCheckHolder> 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<MagikCheckHolder.Parameter> parameters =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -58,15 +57,4 @@ public static List<Class<? extends MagikCheck>> 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<Class<? extends MagikCheck>> getDisabledByDefaultChecks() {
return getChecks().stream()
.filter(checkClass -> checkClass.getAnnotation(DisabledByDefault.class) != null)
.toList();
}
}

0 comments on commit a354a19

Please sign in to comment.