use of net.sourceforge.pmd.lang.LanguageVersionDiscoverer in project Gargoyle by callakrsos.
the class DoPMD method getApplicableLanguages.
private Set<Language> getApplicableLanguages(GargoylePMDConfiguration configuration, RuleSets ruleSets) {
Set<Language> languages = new HashSet<>();
LanguageVersionDiscoverer discoverer = configuration.getLanguageVersionDiscoverer();
for (Rule rule : ruleSets.getAllRules()) {
Language language = rule.getLanguage();
if (languages.contains(language)) {
continue;
}
LanguageVersion version = discoverer.getDefaultLanguageVersion(language);
if (RuleSet.applies(rule, version)) {
languages.add(language);
}
}
return languages;
}
Aggregations