|
20 | 20 | import java.nio.file.Files;
|
21 | 21 | import java.nio.file.Path;
|
22 | 22 | import java.nio.file.StandardCopyOption;
|
23 |
| -import java.util.List; |
24 | 23 |
|
25 | 24 | import javax.annotation.Nullable;
|
26 | 25 | import javax.inject.Inject;
|
@@ -97,7 +96,6 @@ public void performAction(InputChanges inputs) throws Exception {
|
97 | 96 | @VisibleForTesting
|
98 | 97 | void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter, File input) throws IOException {
|
99 | 98 | File output = getOutputFileWithBaseDir(input, outputDirectory);
|
100 |
| - File lint = getOutputFileWithBaseDir(input, lintDirectory); |
101 | 99 | getLogger().debug("Applying format to {} and writing to {}", input, output);
|
102 | 100 | LintState lintState;
|
103 | 101 | if (ratchet != null && ratchet.isClean(getProjectDir().get().getAsFile(), getRootTreeSha(), input)) {
|
@@ -130,22 +128,15 @@ void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter, File in
|
130 | 128 | var lints = lintState.getLints(formatter);
|
131 | 129 | var first = lints.entrySet().iterator().next();
|
132 | 130 | getExceptionPolicy().handleError(new Throwable(first.getValue().get(0).toString()), first.getKey(), FormatExtension.relativize(getProjectDir().get().getAsFile(), input));
|
133 |
| - // Files.createDirectories(lint.toPath().getParent()); |
134 |
| - // Files.write(lint.toPath(), lintState.asString().getBytes()); |
135 |
| - } else { |
136 |
| - Files.deleteIfExists(lint.toPath()); |
137 | 131 | }
|
138 | 132 | }
|
139 | 133 |
|
140 | 134 | private void deletePreviousResults(File input) throws IOException {
|
141 | 135 | File output = getOutputFileWithBaseDir(input, outputDirectory);
|
142 |
| - File lint = getOutputFileWithBaseDir(input, lintDirectory); |
143 |
| - for (File file : List.of(output, lint)) { |
144 |
| - if (file.isDirectory()) { |
145 |
| - getFs().delete(d -> d.delete(file)); |
146 |
| - } else { |
147 |
| - Files.deleteIfExists(file.toPath()); |
148 |
| - } |
| 136 | + if (output.isDirectory()) { |
| 137 | + getFs().delete(d -> d.delete(output)); |
| 138 | + } else { |
| 139 | + Files.deleteIfExists(output.toPath()); |
149 | 140 | }
|
150 | 141 | }
|
151 | 142 |
|
|
0 commit comments