use of com.google.javascript.refactoring.FixingErrorManager in project closure-compiler by google.
the class Linter method fix.
/**
* @return Whether any fixes were applied.
*/
private static boolean fix(String filename, ImmutableSet<DiagnosticType> unfixableErrors) throws IOException {
Compiler compiler = new Compiler(System.out);
FixingErrorManager errorManager = new FixingErrorManager(unfixableErrors);
compiler.setErrorManager(errorManager);
errorManager.setCompiler(compiler);
lint(Paths.get(filename), compiler);
Collection<SuggestedFix> fixes = errorManager.getAllFixes();
if (!fixes.isEmpty()) {
ApplySuggestedFixes.applySuggestedFixesToFiles(fixes);
return true;
}
return false;
}
Aggregations