KtlintAnalyzer implements Analyzer<List<LocatedLintError>> { public KtlintResult analyze() { final ErrorListener listener = new ErrorListener(); for (final File src : config.getSources(KOTLIN)) { try { listener.currentFile = src; KtLint.INSTANCE.lint(new KtLint.Params( src.getAbsolutePath(), readFile(src), findRuleSets(), emptyMap(), listener, false, null, false)); } catch (IOException e) { LOG.error("Could not read file {}", src, e); } } return createResult(listener); } KtlintAnalyzer(AnalyzerConfig config, KtlintCollector collector); private  KtlintAnalyzer(AnalyzerConfig config, KtlintCollector collector, List<RuleSet> ruleSets); KtlintAnalyzer withRuleSets(RuleSet... ruleSets); KtlintResult analyze();  }
@Test void analyze() { final KtlintResult result = new KtlintAnalyzer(AnalyzerConfig.maven(KOTLIN).test(), new KtlintCollector() .just(In.classes("Linker").ignore("no-semi"))).analyze(); assertMatcher("" + line("import-ordering", "Linker", 18, "Imports must be ordered in lexicographic order without any empty lines in-between") + line("no-consecutive-blank-lines", "Linker", 34, "Needless blank line(s)") + line("no-unused-imports", "Linker", 18, "Unused import") + line("no-wildcard-imports", "Linker", 19, "Wildcard import"), result, hasNoKtlintIssues()); }