Search in sources :

Example 1 with CpdMapping

use of org.sonar.api.batch.CpdMapping in project sonarqube by SonarSource.

the class DefaultCpdBlockIndexer method index.

@Override
public void index(String languageKey) {
    CpdMapping mapping = mappings.getMapping(languageKey);
    if (mapping == null) {
        LOG.debug("No CpdMapping for language {}", languageKey);
        return;
    }
    String[] cpdExclusions = settings.getStringArray(CoreProperties.CPD_EXCLUSIONS);
    logExclusions(cpdExclusions);
    FilePredicates p = fs.predicates();
    List<InputFile> sourceFiles = Lists.newArrayList(fs.inputFiles(p.and(p.hasType(InputFile.Type.MAIN), p.hasLanguage(languageKey), p.doesNotMatchPathPatterns(cpdExclusions))));
    if (sourceFiles.isEmpty()) {
        return;
    }
    // Create index
    populateIndex(languageKey, sourceFiles, mapping);
}
Also used : CpdMapping(org.sonar.api.batch.CpdMapping) FilePredicates(org.sonar.api.batch.fs.FilePredicates) InputFile(org.sonar.api.batch.fs.InputFile) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile)

Aggregations

CpdMapping (org.sonar.api.batch.CpdMapping)1 FilePredicates (org.sonar.api.batch.fs.FilePredicates)1 InputFile (org.sonar.api.batch.fs.InputFile)1 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)1