@@ -68,7 +68,8 @@ public void performAction(InputChanges inputs) throws Exception {
68
68
getLogger ().info ("Not incremental: removing prior outputs" );
69
69
getFs ().delete (d -> d .delete (outputDirectory ));
70
70
Files .createDirectories (contentDir ().toPath ());
71
- Files .createDirectories (lintDir ().toPath ());
71
+ Files .createDirectories (lintApplyDir ().toPath ());
72
+ Files .createDirectories (lintCheckDir ().toPath ());
72
73
}
73
74
74
75
try (Formatter formatter = buildFormatter ()) {
@@ -90,14 +91,16 @@ private void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter,
90
91
File output = getOutputFile (input );
91
92
getLogger ().debug ("Applying format to " + input + " and writing to " + output );
92
93
DirtyState dirtyState ;
93
- List <Lint > lints ;
94
+ List <Lint > lintsCheck , lintsApply ;
94
95
if (ratchet != null && ratchet .isClean (getProjectDir ().get ().getAsFile (), getRootTreeSha (), input )) {
95
96
dirtyState = DirtyState .clean ();
96
- lints = Collections .emptyList ();
97
+ lintsCheck = Collections .emptyList ();
98
+ lintsApply = Collections .emptyList ();
97
99
} else {
98
100
DirtyState .Calculation calculation = DirtyState .of (formatter , input );
99
101
dirtyState = calculation .calculateDirtyState ();
100
- lints = calculation .calculateLintAgainstRaw ();
102
+ lintsCheck = calculation .calculateLintAgainstRaw ();
103
+ lintsApply = calculation .calculateLintAgainstDirtyState (dirtyState , lintsCheck );
101
104
}
102
105
if (dirtyState .isClean ()) {
103
106
// Remove previous output if it exists
@@ -115,25 +118,34 @@ private void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter,
115
118
dirtyState .writeCanonicalTo (output );
116
119
}
117
120
118
- File lint = getLintFile (input );
121
+ writeLints (lintsCheck , getLintCheckFile (input ));
122
+ writeLints (lintsApply , getLintApplyFile (input ));
123
+ }
124
+
125
+ private void writeLints (List <Lint > lints , File lintFile ) throws IOException {
119
126
if (lints .isEmpty ()) {
120
- Files .deleteIfExists (lint .toPath ());
127
+ Files .deleteIfExists (lintFile .toPath ());
121
128
} else {
122
- Lint .toFile (lints , lint );
129
+ Lint .toFile (lints , lintFile );
123
130
}
124
131
}
125
132
126
133
private void deletePreviousResult (File input ) throws IOException {
127
134
delete (getOutputFile (input ));
128
- delete (getLintFile (input ));
135
+ delete (getLintCheckFile (input ));
136
+ delete (getLintApplyFile (input ));
129
137
}
130
138
131
139
private File getOutputFile (File input ) {
132
140
return new File (contentDir (), relativize (input ));
133
141
}
134
142
135
- private File getLintFile (File input ) {
136
- return new File (lintDir (), relativize (input ));
143
+ private File getLintCheckFile (File input ) {
144
+ return new File (lintCheckDir (), relativize (input ));
145
+ }
146
+
147
+ private File getLintApplyFile (File input ) {
148
+ return new File (lintApplyDir (), relativize (input ));
137
149
}
138
150
139
151
private void delete (File file ) throws IOException {
0 commit comments