@@ -33,6 +33,8 @@ public class SpotlessApplyMojo extends AbstractSpotlessMojo {
33
33
34
34
@ Override
35
35
protected void process (Iterable <File > files , Formatter formatter , UpToDateChecker upToDateChecker ) throws MojoExecutionException {
36
+ ImpactedFilesTracker impactedFilesTracker = new ImpactedFilesTracker ();
37
+
36
38
for (File file : files ) {
37
39
if (upToDateChecker .isUpToDate (file .toPath ())) {
38
40
if (getLog ().isDebugEnabled ()) {
@@ -42,16 +44,22 @@ protected void process(Iterable<File> files, Formatter formatter, UpToDateChecke
42
44
}
43
45
44
46
try {
47
+ impactedFilesTracker .checked ();
45
48
PaddedCell .DirtyState dirtyState = PaddedCell .calculateDirtyState (formatter , file );
46
49
if (!dirtyState .isClean () && !dirtyState .didNotConverge ()) {
50
+ getLog ().info (String .format ("Writing clean file: %s" , file ));
47
51
dirtyState .writeCanonicalTo (file );
48
52
buildContext .refresh (file );
53
+ impactedFilesTracker .cleaned ();
49
54
}
50
55
} catch (IOException e ) {
51
56
throw new MojoExecutionException ("Unable to format file " + file , e );
52
57
}
53
58
54
59
upToDateChecker .setUpToDate (file .toPath ());
55
60
}
61
+
62
+ // We print the number of considered files which is useful when ratchetFrom is setup
63
+ getLog ().info (String .format ("A formatter with %s steps cleaned: %s files (for %s considered)" , formatter .getSteps ().size (), impactedFilesTracker .getCleaned (), impactedFilesTracker .getChecked ()));
56
64
}
57
65
}
0 commit comments