use of com.walmartlabs.concord.cli.runner.CliImportsListener in project concord by walmartlabs.
the class Lint method call.
@Override
public Integer call() throws Exception {
if (!Files.isDirectory(targetDir)) {
throw new IllegalArgumentException("Not a directory: " + targetDir);
}
ProjectLoader loader = new ProjectLoader(new NoopImportManager());
ProcessDefinition pd = loader.loadProject(targetDir, new DummyImportsNormalizer(), verbose ? new CliImportsListener() : null).projectDefinition();
List<LintResult> lintResults = new ArrayList<>();
linters().forEach(l -> lintResults.addAll(l.apply(pd)));
if (!lintResults.isEmpty()) {
print(lintResults);
println();
}
println("Found:");
println(" imports: " + pd.imports().items().size());
println(" profiles: " + pd.profiles().size());
println(" flows: " + pd.flows().size());
println(" forms: " + pd.forms().size());
println(" triggers: " + pd.triggers().size());
println(" (not counting dynamically imported resources)");
println();
printStats(lintResults);
println();
boolean hasErrors = hasErrors(lintResults);
if (hasErrors) {
println("@|red,bold INVALID|@");
} else {
println("@|green,bold VALID|@");
}
return hasErrors ? 10 : 0;
}
Aggregations