diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java index 30532a0607..9e6f5ca9cf 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java @@ -15,6 +15,8 @@ */ package com.diffplug.spotless.maven; +import static java.util.stream.Collectors.toList; + import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -60,8 +62,6 @@ import com.diffplug.spotless.maven.sql.Sql; import com.diffplug.spotless.maven.typescript.Typescript; -import static java.util.stream.Collectors.toList; - public abstract class AbstractSpotlessMojo extends AbstractMojo { private static final String DEFAULT_ENCODING = "UTF-8"; @@ -180,14 +180,14 @@ private List collectFiles(FormatterFactory formatterFactory, FormatterConf private List collectFilesFromGit(FormatterFactory formatterFactory, String ratchetFrom) throws MojoExecutionException { MatchPatterns includePatterns = MatchPatterns.from( - withNormalizedFileSeparators(getIncludes(formatterFactory))); + withNormalizedFileSeparators(getIncludes(formatterFactory))); MatchPatterns excludePatterns = MatchPatterns.from( - withNormalizedFileSeparators(getExcludes(formatterFactory))); + withNormalizedFileSeparators(getExcludes(formatterFactory))); Iterable dirtyFiles; try { dirtyFiles = GitRatchetMaven - .instance().getDirtyFiles(baseDir, ratchetFrom); + .instance().getDirtyFiles(baseDir, ratchetFrom); } catch (IOException e) { throw new MojoExecutionException("Unable to scan file tree rooted at " + baseDir, e); } catch (GitAPIException e) { @@ -195,7 +195,7 @@ private List collectFilesFromGit(FormatterFactory formatterFactory, String } List result = new ArrayList<>(); - for (String file: withNormalizedFileSeparators(dirtyFiles)) { + for (String file : withNormalizedFileSeparators(dirtyFiles)) { if (includePatterns.matches(file, true)) { if (!excludePatterns.matches(file, true)) { result.add(Paths.get(baseDir.getPath(), file).toFile()); @@ -215,9 +215,9 @@ private List collectFilesFromFormatterFactory(FormatterFactory formatterFa private Iterable withNormalizedFileSeparators(Iterable patterns) { return StreamSupport.stream(patterns.spliterator(), true) - .map(pattern -> pattern.replace('/', File.separatorChar)) - .map(pattern -> pattern.replace('\\', File.separatorChar)) - .collect(Collectors.toSet()); + .map(pattern -> pattern.replace('/', File.separatorChar)) + .map(pattern -> pattern.replace('\\', File.separatorChar)) + .collect(Collectors.toSet()); } private static String withTrailingSeparator(String path) { diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/GitRatchetMaven.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/GitRatchetMaven.java index 31b71bc455..db6330087f 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/GitRatchetMaven.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/GitRatchetMaven.java @@ -69,17 +69,17 @@ Iterable getDirtyFiles(File baseDir, String ratchetFrom) Git git = new Git(repository); List diffs = git.diff() - .setShowNameAndStatusOnly(true) - .setOldTree(oldTree) - .call(); + .setShowNameAndStatusOnly(true) + .setOldTree(oldTree) + .call(); String workTreePath = repository.getWorkTree().getPath(); Path baseDirPath = Paths.get(baseDir.getPath()); return diffs.stream() - .map(DiffEntry::getNewPath) - .map(path -> Paths.get(workTreePath, path)) - .map(path -> baseDirPath.relativize(path).toString()) - .collect(Collectors.toList()); + .map(DiffEntry::getNewPath) + .map(path -> Paths.get(workTreePath, path)) + .map(path -> baseDirPath.relativize(path).toString()) + .collect(Collectors.toList()); } }