diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 075f411..2187d7b 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -16,17 +16,23 @@ - - - - - + + + + + + + + + + + + + + - - - @@ -38,32 +44,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + @@ -74,9 +128,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -84,6 +176,7 @@ + @@ -104,17 +197,53 @@ + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index caf5afe..0e89103 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -1,10 +1,12 @@ - + - + + + + + + diff --git a/gradle.lockfile b/gradle.lockfile index 9eec620..ac4c38a 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -9,7 +9,7 @@ com.google.errorprone:error_prone_annotations:2.23.0=checkstyle com.google.guava:failureaccess:1.0.2=checkstyle com.google.guava:guava:33.0.0-jre=checkstyle com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle -com.puppycrawl.tools:checkstyle:10.12.7=checkstyle +com.puppycrawl.tools:checkstyle:10.13.0=checkstyle commons-beanutils:commons-beanutils:1.9.4=checkstyle commons-codec:commons-codec:1.15=checkstyle commons-collections:commons-collections:3.2.2=checkstyle diff --git a/settings.gradle b/settings.gradle index 4c98ef7..b0805c5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ rootProject.name = 'strict-null-check' dependencyResolutionManagement { versionCatalogs { libs { - version('checkstyle', '10.12.7') + version('checkstyle', '10.13.0') version('junit', '5.10.1') version('sonarlint-core', '9.6.1.76766') diff --git a/src/main/java/io/github/joselion/strictnullcheck/lib/GeneratePackageInfoTask.java b/src/main/java/io/github/joselion/strictnullcheck/lib/GeneratePackageInfoTask.java index 2e2823a..0c07260 100644 --- a/src/main/java/io/github/joselion/strictnullcheck/lib/GeneratePackageInfoTask.java +++ b/src/main/java/io/github/joselion/strictnullcheck/lib/GeneratePackageInfoTask.java @@ -49,7 +49,7 @@ public Set getSourcePackages() { .stream() .flatMap(sourceSet -> sourceSet.getAllJava().getSrcDirs().stream()) .map(File::toPath) - .filter(path -> !path.startsWith(getGeneratedDir().getPath())) + .filter(path -> !path.startsWith(this.getGeneratedDir().getPath())) .flatMap(path -> Maybe.of(path).solve(Files::walk).orElseGet(Stream::empty)) .filter(subdir -> Files.notExists(subdir.resolve("package-info.java"))) .flatMap(subdir -> Maybe.of(subdir).solve(Files::list).orElseGet(Stream::empty)) @@ -85,7 +85,7 @@ private void buildPackageInfo(final String packageName) { final var basePath = this.getGeneratedDir().getPath(); final var dashedPath = packageName.replace(".", "/"); final var dir = this.project.mkdir(basePath.concat("/java/main/").concat(dashedPath)); - final var templateOutput = getPackageInfoTemplate(packageName); + final var templateOutput = this.getPackageInfoTemplate(packageName); final var outputFile = new File(dir.getAbsolutePath(), "package-info.java"); Maybe.of(outputFile) @@ -96,7 +96,7 @@ private void buildPackageInfo(final String packageName) { } }) .orThrow(exception -> { - project.getLogger().error( + this.project.getLogger().error( "Unable to generate package-info.java at [%s]".formatted(outputFile), exception ); diff --git a/src/testkit/java/testing/Helpers.java b/src/testkit/java/testing/Helpers.java index 5e1e50e..a140291 100644 --- a/src/testkit/java/testing/Helpers.java +++ b/src/testkit/java/testing/Helpers.java @@ -7,7 +7,7 @@ import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.GradleRunner; -public class Helpers { +public final class Helpers { public static final Path PROJECT_PATH = Path.of("build/testkit"); @@ -15,6 +15,10 @@ public class Helpers { public static final Path TEST_PATH = PROJECT_PATH.resolve("src/test/java/com/example/app"); + private Helpers() { + throw new UnsupportedOperationException("Helpers is a helper class"); + } + public static void writeBuildGradle(final String text) { try { Files.writeString(PROJECT_PATH.resolve("build.gradle"), text);