diff --git a/.ci/validation.sh b/.ci/validation.sh index df1e027c2b5b..0263edfff3fb 100755 --- a/.ci/validation.sh +++ b/.ci/validation.sh @@ -1365,30 +1365,26 @@ spotless) ./mvnw -e --no-transfer-progress clean spotless:check -P spotless-autofix ;; -openrewrite-recipes) - echo "Cloning and building OpenRewrite recipes..." - PROJECT_ROOT="$(pwd)" +sanity-check) export MAVEN_OPTS="-Xmx4g -Xms2g" - + echo "Sanity Check ๐Ÿฆข" + echo "Cloning and building OpenRewrite recipes ๐Ÿ“ฅ" cd /tmp git clone https://github.com/checkstyle/checkstyle-openrewrite-recipes.git cd checkstyle-openrewrite-recipes mvn -e --no-transfer-progress clean install -DskipTests - - cd "$PROJECT_ROOT" - - echo "Running Checkstyle validation to get report for openrewrite..." + cd "$(pwd)" + echo "Run Checkstyle validation to get report for openrewrite โ˜‘๏ธ" set +e ./mvnw -e --no-transfer-progress clean compile antrun:run@ant-phase-verify set -e - echo "Running OpenRewrite recipes..." + echo "Run OpenRewrite recipes โ˜‘๏ธ" ./mvnw -e --no-transfer-progress -Drewrite.recipeChangeLogLevel=INFO \ rewrite:run -P checkstyle-autofix - - echo "Checking for uncommitted changes..." + echo "Checking for uncommitted changes ๐Ÿ“‹" ./.ci/print-diff-as-patch.sh target/rewrite.patch - rm -rf /tmp/checkstyle-openrewrite-recipes + echo "Complete โ˜‘๏ธ" ;; *) diff --git a/.circleci/config.yml b/.circleci/config.yml index 598c7da5459d..4c1a70c48cad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,13 @@ -version: 2.1 - +name: "CI โ™ป๏ธ" +version: "2.1" jobs: - run-inspections: docker: - - image: amitkumardeoghoria/idea-image:jdk21-idea2022.3.3-v1 - + - image: "amitkumardeoghoria/idea-image:jdk21-idea2022.3.3-v1" steps: - checkout - run: - name: Print versions + name: "Print Versions ๐Ÿ“‹" command: | echo "Maven version:" ./mvnw --version @@ -18,57 +16,58 @@ jobs: echo "IDEA version:" echo $IDEA_VERSION - run: - name: Run inspections + name: "Run Inspections ๐Ÿš€" command: | mkdir .idea cp config/intellij-idea-inspections-misc.xml .idea/misc.xml ./.ci/idea-inspection.sh - no_output_timeout: 25m - working_directory: ~/project + no_output_timeout: "25m" + working_directory: "~/project" - store_artifacts: - path: /home/circleci/project/target/inspection-results - + name: "Store Artifacts ๐Ÿ“ฆ" + path: "/home/circleci/project/target/inspection-results" validate-with-maven-script: description: "Runs a maven script using the job name as the argument." parameters: &script_parameters image-name: - type: string + type: "string" default: "cimg/openjdk:21.0.6" description: "docker image to use" command: description: "command to run" - type: string + type: "string" default: "" docker: - - image: << parameters.image-name >> + - image: "<< parameters.image-name >>" steps: - checkout - restore_cache: - name: Restore Maven repo and wrapper cache + name: "Restore Cache ๐Ÿ”„" keys: - - mvn-cache-{{ checksum "pom.xml" }} + - "mvn-cache-{{ checksum \"pom.xml\" }}" - run: - command: << parameters.command >> + name: "Execute Command โšก" + command: "<< parameters.command >>" - run: + name: "Run Validation Scripts โœ…" command: | ./.ci/validation.sh git-diff ./.ci/validation.sh ci-temp-check - save_cache: - name: Save Maven repo and wrapper cache - key: mvn-cache-{{ checksum "pom.xml" }} + name: "Save Cache ๐Ÿ’พ" + key: "mvn-cache-{{ checksum \"pom.xml\" }}" paths: - - .m2 - - .mvn/wrapper - + - ".m2" + - ".mvn/wrapper" validate-with-script: description: "Runs a non-maven script using the job name as the argument." parameters: *script_parameters docker: - - image: << parameters.image-name >> + - image: "<< parameters.image-name >>" steps: - checkout - run: - name: run << parameters.command >> + name: "Run Validation Script ๐Ÿ› ๏ธ" command: | sudo apt update sudo apt install -y xmlstarlet --no-install-recommends apt-utils @@ -76,262 +75,238 @@ jobs: export PR_HEAD_SHA=$CIRCLE_SHA1 export PR_NUMBER=$CIRCLE_PR_NUMBER << parameters.command >> - sonarqube: docker: - - image: amitkumardeoghoria/jdk-21-groovy-git-mvn-ant-jq:v1 - + - image: "amitkumardeoghoria/jdk-21-groovy-git-mvn-ant-jq:v1" steps: - checkout - run: - name: Run sonarqube + name: "Run SonarQube ๐Ÿš€" command: | export PR_NUMBER=$CIRCLE_PR_NUMBER export PR_BRANCH_NAME=$CIRCLE_BRANCH export SONAR_API_TOKEN=$SONAR_TOKEN ./.ci/validation.sh sonarqube - yamllint: docker: - - image: cimg/base:2022.11 - + - image: "cimg/base:2022.11" steps: - checkout - run: - name: Install dependencies + name: "Install Dependencies ๐Ÿ“ฅ" command: | sudo apt update sudo apt install -y yamllint - run: - name: Run yamllint - command: yamllint -f parsable -c config/yamllint.yaml . - + name: "Run YAML Lint ๐Ÿš€" + command: "yamllint -f parsable -c config/yamllint.yaml ." workflows: - # sonarqube: - # jobs: - # - sonarqube: - # context: - # - sonarqube - test: jobs: - # no-exception-test script - validate-with-maven-script: - name: "no-exception-lucene-and-others-javadoc" + name: "No Exception Lucene Javadoc ๐Ÿ“š" image-name: &cs_img "amitkumardeoghoria/jdk-21-groovy-git-mvn-ant-jq:v1" command: "./.ci/no-exception-test.sh no-exception-lucene-and-others-javadoc" - validate-with-maven-script: - name: "no-exception-cassandra-storm-tapestry-javadoc" + name: "No Exception Cassandra Javadoc ๐Ÿ“š" image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-cassandra-storm-tapestry-javadoc" - validate-with-maven-script: - name: "no-exception-hadoop-apache-groovy-scouter-javadoc" + name: "No Exception Hadoop Javadoc ๐Ÿ“š" image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-hadoop-apache-groovy-scouter-javadoc" - validate-with-maven-script: - name: "no-exception-only-javadoc" + name: "No Exception Only Javadoc ๐Ÿ“š" image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-only-javadoc" - - # validation script - validate-with-maven-script: - name: "no-error-xwiki" + name: "No Error XWiki โœ…" image-name: "cimg/openjdk:21.0.6" command: "./.ci/validation.sh no-error-xwiki" - validate-with-maven-script: - name: "no-error-pmd" + name: "No Error PMD โœ…" image-name: *cs_img command: "./.ci/validation.sh no-error-pmd" - validate-with-maven-script: - name: "no-exception-struts" + name: "No Exception Struts โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-struts" - validate-with-maven-script: - name: "no-exception-checkstyle-sevntu" + name: "No Exception Checkstyle โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-checkstyle-sevntu" - validate-with-maven-script: - name: "no-exception-checkstyle-sevntu-javadoc" + name: "No Exception Checkstyle Javadoc ๐Ÿ“š" image-name: *cs_img command: "./.ci/validation.sh no-exception-checkstyle-sevntu-javadoc" - validate-with-maven-script: - name: "no-exception-guava" + name: "No Exception Guava โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-guava" - validate-with-maven-script: - name: "no-exception-hibernate-orm" + name: "No Exception Hibernate โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-hibernate-orm" - validate-with-maven-script: - name: "no-exception-spotbugs" + name: "No Exception SpotBugs โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-spotbugs" - validate-with-maven-script: - name: "no-exception-spoon" + name: "No Exception Spoon โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-spoon" - validate-with-maven-script: - name: "no-exception-spring-framework" + name: "No Exception Spring โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-spring-framework" - validate-with-maven-script: - name: "no-exception-hbase" + name: "No Exception HBase โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-hbase" - validate-with-maven-script: - name: "no-exception-Pmd-elasticsearch-lombok-ast" + name: "No Exception PMD ElasticSearch โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-Pmd-elasticsearch-lombok-ast" - validate-with-maven-script: - name: "no-exception-alot-of-projects" + name: "No Exception Many Projects โœ…" image-name: *cs_img command: "./.ci/validation.sh no-exception-alot-of-projects" - validate-with-maven-script: - name: "no-warning-imports-guava" + name: "No Warning Imports Guava โš ๏ธ" image-name: *cs_img command: "./.ci/validation.sh no-warning-imports-guava" - validate-with-maven-script: - name: "no-warning-imports-java-design-patterns" + name: "No Warning Imports Design Patterns โš ๏ธ" image-name: *cs_img command: "./.ci/validation.sh no-warning-imports-java-design-patterns" - validate-with-maven-script: - name: "checkstyle-and-sevntu" + name: "Checkstyle and Sevntu โœ…" image-name: *cs_img command: "./.ci/validation.sh checkstyle-and-sevntu" - # https://github.com/spotbugs/spotbugs-maven-plugin/issues/806 explains - # why we need execution of spotbugs without any other maven plugins which can change binaries - validate-with-maven-script: - name: "spotbugs-and-pmd" + name: "SpotBugs and PMD โœ…" image-name: *cs_img command: "./.ci/validation.sh spotbugs-and-pmd" - validate-with-maven-script: - name: "site" + name: "Site Generation ๐ŸŒ" image-name: *cs_img command: "./.ci/validation.sh site" - validate-with-maven-script: - name: "release-dry-run" + name: "Release Dry Run ๐Ÿš€" image-name: *cs_img command: "./.ci/validation.sh release-dry-run" - validate-with-maven-script: - name: "assembly-run-all-jar" + name: "Assembly Run All JAR ๐Ÿ“ฆ" image-name: *cs_img command: "./.ci/validation.sh assembly-run-all-jar" - validate-with-maven-script: - name: "no-error-test-sbe" + name: "No Error Test SBE โœ…" image-name: "cimg/openjdk:21.0.6" command: "./.ci/validation.sh no-error-test-sbe" - validate-with-maven-script: - name: "no-error-spotbugs" + name: "No Error SpotBugs โœ…" image-name: *cs_img command: "./.ci/validation.sh no-error-spotbugs" - validate-with-maven-script: - name: "no-error-pgjdbc" + name: "No Error PGJDBC โœ…" image-name: "cimg/openjdk:21.0" command: "./.ci/validation.sh no-error-pgjdbc" - validate-with-maven-script: - name: "linkcheck-plugin" + name: "Link Check Plugin ๐Ÿ”—" image-name: "cimg/openjdk:21.0.6" command: "./.ci/run-link-check-plugin.sh --skip-external" - validate-with-maven-script: - name: "no-exception-samples-gradle" + name: "No Exception Gradle Samples โœ…" image-name: "cimg/openjdk:17.0.7" command: "./.ci/no-exception-test.sh no-exception-samples-gradle" - validate-with-maven-script: - name: "no-exception-samples-maven" + name: "No Exception Maven Samples โœ…" image-name: "cimg/openjdk:21.0.6" command: "./.ci/no-exception-test.sh no-exception-samples-maven" - - validate-with-maven-script: - name: "no-exception-samples-ant" + name: "No Exception Ant Samples โœ…" image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-samples-ant" - validate-with-maven-script: - name: "no-error-hazelcast" + name: "No Error Hazelcast โœ…" image-name: *cs_img command: "./.ci/validation.sh no-error-hazelcast" - idea: jobs: - run-inspections - git-validation: jobs: - validate-with-script: - name: "git-no-merge-commits" + name: "Git No Merge Commits ๐Ÿšซ" command: "./.ci/validation.sh git-no-merge-commits" - validate-with-script: - name: "git-check-pull-number" + name: "Git Check Pull Number ๐Ÿ”ข" command: "./.ci/validation.sh git-check-pull-number" - cli-validation: jobs: - yamllint - validate-with-script: - name: "checkchmod" + name: "Check CHMOD Permissions ๐Ÿ”" command: "./.ci/checkchmod.sh" - validate-with-script: - name: "check-github-workflows-concurrency" + name: "Check GitHub Workflows Concurrency ๐Ÿ”„" command: "./.ci/validation.sh check-github-workflows-concurrency" - validate-with-script: - name: "check-wildcards-on-pitest-target-classes" + name: "Check Wildcards on Pitest ๐ŸŽฏ" image-name: "cimg/base:2022.11" command: "./.ci/validation.sh check-wildcards-on-pitest-target-classes" - javac-validation: jobs: - validate-with-script: - name: "check-since-version" + name: "Check Since Version ๐Ÿ”" command: "./.ci/validation.sh check-since-version" - validate-with-script: - name: "javac17_standard" + name: "JavaC 17 Standard ๐ŸŸข" image-name: "cimg/openjdk:17.0.7" command: "./.ci/validation.sh javac17_standard" - validate-with-script: - name: "javac17" + name: "JavaC 17 ๐ŸŸข" image-name: "cimg/openjdk:17.0.7" command: "./.ci/validation.sh javac17" - validate-with-script: - name: "java 21 test resources compile" + name: "Java 21 Test Resources Compile ๐Ÿงช" image-name: "cimg/openjdk:21.0.8" command: "./.ci/validation.sh compile-test-resources" - validate-with-script: - name: "javac19" + name: "JavaC 19 ๐ŸŸข" image-name: "cimg/openjdk:19.0.1" command: "./.ci/validation.sh javac19" - validate-with-script: - name: "javac20" + name: "JavaC 20 ๐ŸŸข" image-name: "cimg/openjdk:20.0.1" command: "./.ci/validation.sh javac20" - validate-with-script: - name: "javac21" + name: "JavaC 21 ๐ŸŸข" image-name: "cimg/openjdk:21.0.6" command: "./.ci/validation.sh javac21" - validate-with-script: - name: "javac22" + name: "JavaC 22 ๐ŸŸข" image-name: "cimg/openjdk:22.0.2" command: "./.ci/validation.sh javac22" - validate-with-script: - name: "javac25" + name: "JavaC 25 ๐ŸŸข" image-name: "cimg/openjdk:25.0" command: "./.ci/validation.sh javac25" - site-validation: jobs: - validate-with-maven-script: - name: "jdk21-package-site" + name: "JDK 21 Package Site ๐Ÿ“ฆ" image-name: *cs_img command: "./.ci/validation.sh package-site" - - openrewrite: + rewrite: jobs: - validate-with-maven-script: - name: "openrewrite-recipes" + name: "Sanity Check ๐Ÿฆข" image-name: "cimg/openjdk:21.0" - command: "./.ci/validation.sh openrewrite-recipes" - + command: "./.ci/validation.sh sanity-check" spotless: jobs: - validate-with-maven-script: - name: spotless + name: "Spotless โœจ" image-name: "cimg/openjdk:21.0" command: "./.ci/validation.sh spotless" diff --git a/pom.xml b/pom.xml index 91ad63779c9f..854d35f8022d 100644 --- a/pom.xml +++ b/pom.xml @@ -5455,7 +5455,7 @@ true true - org.checkstyle.AllAutoFixes + org.checkstyle.openrewrite.SanityCheck **.ci-temp** diff --git a/rewrite.yml b/rewrite.yml index 8139c1e90626..394b6a726ead 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -1,6 +1,6 @@ --- type: specs.openrewrite.org/v1beta/recipe -name: org.checkstyle.AllAutoFixes +name: org.checkstyle.openrewrite.SanityCheck displayName: Auto Fixes description: List of auto fixes from different providers. recipeList: