Skip to content

Commit 17d44b6

Browse files
author
Gonzalo Diaz
committed
[CONFIG] auto fix format sources capacity added. Makefile action "format" added.
1 parent 4084df9 commit 17d44b6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ lint: lint/markdown lint/yaml test/styling test/static
6060
test/styling: dependencies
6161
$(GRADLE) --console=verbose clean checkstyleMain checkstyleTest
6262

63+
64+
format/sources:
65+
$(GRADLE) --console=verbose rewriteRun
66+
67+
format: format/sources
68+
6369
test/static: dependencies
6470

6571
test: env

algorithm-exercises-java/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
// Apply the application plugin to add support for building a CLI application in Java.
1111
id 'application'
1212
id 'checkstyle'
13+
id 'org.openrewrite.rewrite' version '7.6.2'
1314
id 'jacoco'
1415
id 'org.barfuin.gradle.jacocolog' version '3.1.0'
1516
id 'com.adarshr.test-logger' version '4.0.0'
@@ -35,6 +36,7 @@ dependencies {
3536
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.19.0'
3637
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.19.0'
3738

39+
rewrite 'org.openrewrite.recipe:rewrite-static-analysis:latest.release'
3840
}
3941

4042
application {
@@ -55,6 +57,12 @@ checkstyle {
5557
showViolations = true
5658
}
5759

60+
// Reference: https://docs.openrewrite.org/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations
61+
rewrite {
62+
activeRecipe 'org.openrewrite.staticanalysis.CodeCleanup'
63+
checkstyleConfigFile = file("checkstyle.xml")
64+
}
65+
5866
configurations.checkstyle {
5967
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
6068
select("com.google.guava:guava:33.4.8-jre")

0 commit comments

Comments
 (0)