private Linter newLinter(final String linterId) { final Linter linter = registry.newLinter(linterId); if (linter != null) { linter.setLintCollector(collector); } else { LOGGER.log(Level.FINE, new StringFormat("Cannot find linter, %s", linterId)); } return linter; }
public Linters(final LinterConfigs linterConfigs) throws SchemaCrawlerException { requireNonNull(linterConfigs, "No linter configs provided"); final Set<String> registeredLinters = registry.allRegisteredLinters(); // Add all configured linters, with as many instances as were // configured for (final LinterConfig linterConfig : linterConfigs) { if (linterConfig == null) { continue; } // First remove the linter id, because it is "seen", // whether it needs to be run or not final String linterId = linterConfig.getLinterId(); registeredLinters.remove(linterId); if (!linterConfig.isRunLinter()) { LOGGER.log(Level.FINE, new StringFormat("Not running configured linter, %s", linterConfig)); continue; } final Linter linter = newLinter(linterId); if (linter != null) { // Configure linter linter.configure(linterConfig); linters.add(linter); } } // Add in all remaining linters that were not configured for (final String linterId : registeredLinters) { final Linter linter = newLinter(linterId); linters.add(linter); } }