From fd17608a3e357ae73a5e5ad65b7dcf9fc8041b47 Mon Sep 17 00:00:00 2001 From: Paul Dingemans Date: Mon, 13 Dec 2021 21:19:15 +0100 Subject: [PATCH] Run the experimental rules by default There is no need for a separate build task to run the experimental rules. The experimental rules can be executed by default in the "ktlint" task. Also, the baseline has been fixed so there is no longer a need to use extension "_kt" for the baseline test files. Closes #1222 --- build.gradle | 13 ++++--------- ...aErrorFile._kt => TestBaselineExtraErrorFile.kt} | 0 .../{TestBaselineFile._kt => TestBaselineFile.kt} | 0 ktlint/src/test/resources/ktlint-test-baseline.xml | 11 +++++++++++ ktlint/src/test/resources/test-baseline.xml | 10 ---------- 5 files changed, 15 insertions(+), 19 deletions(-) rename ktlint/src/test/resources/{TestBaselineExtraErrorFile._kt => TestBaselineExtraErrorFile.kt} (100%) rename ktlint/src/test/resources/{TestBaselineFile._kt => TestBaselineFile.kt} (100%) create mode 100644 ktlint/src/test/resources/ktlint-test-baseline.xml delete mode 100644 ktlint/src/test/resources/test-baseline.xml diff --git a/build.gradle b/build.gradle index af193ce51f..50a7b069fe 100644 --- a/build.gradle +++ b/build.gradle @@ -42,17 +42,12 @@ dependencies { } task ktlint(type: JavaExec, group: LifecycleBasePlugin.VERIFICATION_GROUP) { - description = "Check Kotlin code style." + description = "Check Kotlin code style including experimental rules." classpath = configurations.ktlint main = 'com.pinterest.ktlint.Main' - args '**/src/**/*.kt', '--baseline=ktlint-baseline.xml', '--verbose' -} - -task ktlint_experimental(type: JavaExec, group: LifecycleBasePlugin.VERIFICATION_GROUP) { - description = "Check Kotlin code style with experimental rules." - classpath = configurations.ktlint - main = 'com.pinterest.ktlint.Main' - args '**/src/**/*.kt', '--verbose', '--experimental' + // Experimental rules run by default run on the ktlint code base itself. Experimental rules should not be released if + // we are not pleased ourselves with the results on the ktlint code base. + args '**/src/**/*.kt', '--baseline=ktlint/src/test/resources/ktlint-test-baseline.xml', '--experimental', '--verbose' } /** diff --git a/ktlint/src/test/resources/TestBaselineExtraErrorFile._kt b/ktlint/src/test/resources/TestBaselineExtraErrorFile.kt similarity index 100% rename from ktlint/src/test/resources/TestBaselineExtraErrorFile._kt rename to ktlint/src/test/resources/TestBaselineExtraErrorFile.kt diff --git a/ktlint/src/test/resources/TestBaselineFile._kt b/ktlint/src/test/resources/TestBaselineFile.kt similarity index 100% rename from ktlint/src/test/resources/TestBaselineFile._kt rename to ktlint/src/test/resources/TestBaselineFile.kt diff --git a/ktlint/src/test/resources/ktlint-test-baseline.xml b/ktlint/src/test/resources/ktlint-test-baseline.xml new file mode 100644 index 0000000000..15bc3fbbc0 --- /dev/null +++ b/ktlint/src/test/resources/ktlint-test-baseline.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ktlint/src/test/resources/test-baseline.xml b/ktlint/src/test/resources/test-baseline.xml deleted file mode 100644 index 7ac6085365..0000000000 --- a/ktlint/src/test/resources/test-baseline.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - -