Search in sources :

Example 1 with LanguageVersionDiscoverer

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;
}
Also used : Language(net.sourceforge.pmd.lang.Language) LanguageVersion(net.sourceforge.pmd.lang.LanguageVersion) Rule(net.sourceforge.pmd.Rule) LanguageVersionDiscoverer(net.sourceforge.pmd.lang.LanguageVersionDiscoverer) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Rule (net.sourceforge.pmd.Rule)1 Language (net.sourceforge.pmd.lang.Language)1 LanguageVersion (net.sourceforge.pmd.lang.LanguageVersion)1 LanguageVersionDiscoverer (net.sourceforge.pmd.lang.LanguageVersionDiscoverer)1