From 8bb75abc8a89c2efe4e6e93c7022f56454b917f7 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Fri, 23 May 2025 23:50:47 -0400 Subject: [PATCH] [CONFIG] auto fix format sources capacity added. Makefile action "format" added. --- Makefile | 6 ++++++ algorithm-exercises-java/build.gradle | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 896ea8c..18d5582 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,12 @@ format: format/sources format/json test/styling: dependencies $(GRADLE) --console=verbose clean checkstyleMain checkstyleTest + +format/sources: + $(GRADLE) --console=verbose rewriteRun + +format: format/sources + test/static: dependencies ## Unit tests and coverage diff --git a/algorithm-exercises-java/build.gradle b/algorithm-exercises-java/build.gradle index 2ff6f76..7b8cf02 100644 --- a/algorithm-exercises-java/build.gradle +++ b/algorithm-exercises-java/build.gradle @@ -10,6 +10,7 @@ plugins { // Apply the application plugin to add support for building a CLI application in Java. id 'application' id 'checkstyle' + id 'org.openrewrite.rewrite' version '7.6.2' id 'jacoco' id 'org.barfuin.gradle.jacocolog' version '4.0.1' id 'com.adarshr.test-logger' version '4.0.0' @@ -35,6 +36,7 @@ dependencies { implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.21' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.21.0' + rewrite 'org.openrewrite.recipe:rewrite-static-analysis:latest.release' } application { @@ -55,6 +57,12 @@ checkstyle { showViolations = true } +// Reference: https://docs.openrewrite.org/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations +rewrite { + activeRecipe 'org.openrewrite.staticanalysis.CodeCleanup' + checkstyleConfigFile = file("checkstyle.xml") +} + configurations.checkstyle { resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") { select("com.google.guava:guava:33.5.0-jre")