@TaskAction
public void run() throws IOException {
final PatternSet patternSet = new PatternSet();
patternSet.setIncludes(this.input.getIncludes());
patternSet.setExcludes(this.input.getExcludes());
for (final DirectoryTree dirTree : this.input.getSrcDirTrees()) {
final File dir = dirTree.getDir();
if (!dir.exists() || !dir.isDirectory()) {
continue;
}
final FileTree tree = this.getProject().fileTree(dir).matching(this.input.getFilter()).matching(patternSet);
for (final File file : tree) {
final Map<Integer, String> matches = this.getFileMatches(Files.toString(file, Charsets.UTF_8));
if (!matches.isEmpty()) {
System.out.println();
LOGGER.warn("{} TODO{} found in `{}`", matches.size(), matches.size() == 1 ? "" : "s", file.getName());
for (final Map.Entry<Integer, String> match : matches.entrySet()) {
LOGGER.warn("L{}: {}", match.getKey(), match.getValue().trim());
}
}
}
}
}