From 0a31de43c2f594eab0d391c189da2195e971c522 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 3 Oct 2023 09:06:17 +0100 Subject: [PATCH] Run checkstyle on all source sets Had an issue last week where testFixtures had a couple of issues which I didn't pick up on, as the pre-commit hooks only check the main and test source set. We now add a per-project "checkstyle" task, which dependes on the per-source-set checkstyle tasks. --- .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 1 - .../src/main/kotlin/cc-tweaked.java-convention.gradle.kts | 6 ++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05ec8c9b2..1556ce3fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,7 +44,7 @@ repos: name: Check Java codestyle files: ".*\\.java$" language: system - entry: ./gradlew checkstyleMain checkstyleTest + entry: ./gradlew checkstyle pass_filenames: false require_serial: true - id: illuaminate diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 803fb3fb2..7d2aa3128 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,6 @@ ## Writing documentation [new-issue]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose "Create a new issue" [community]: README.md#community "Get in touch with the community." [Adoptium]: https://adoptium.net/temurin/releases?version=17 "Download OpenJDK 17" -[checkstyle]: https://checkstyle.org/ [illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub" [weblate]: https://i18n.tweaked.cc/projects/cc-tweaked/minecraft/ "CC: Tweaked weblate instance" [docs]: https://tweaked.cc/ "CC: Tweaked documentation" diff --git a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts index fcb5c1670..f7497f8d0 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts @@ -174,6 +174,12 @@ project.plugins.withType(CCTweakedPlugin::class.java) { } } +tasks.register("checkstyle") { + description = "Run Checkstyle on all sources" + group = LifecycleBasePlugin.VERIFICATION_GROUP + dependsOn(tasks.withType(Checkstyle::class.java)) +} + spotless { encoding = StandardCharsets.UTF_8 lineEndings = LineEnding.UNIX