use of net.sourceforge.pmd.util.datasource.ReaderDataSource in project Gargoyle by callakrsos.
the class DoPMD method internalGetApplicableFiles.
private List<DataSource> internalGetApplicableFiles(GargoylePMDConfiguration configuration, Set<Language> languages) {
List<DataSource> files = new ArrayList<>();
LanguageFilenameFilter fileSelector = new LanguageFilenameFilter(languages);
if (null != configuration.getInputPaths()) {
files.addAll(FileUtil.collectFiles(configuration.getInputPaths(), fileSelector));
}
if (null != configuration.getSourceText()) {
String filePaths = "SourceBase";
if (null != configuration.getSourceFileName()) {
filePaths = configuration.getSourceFileName();
}
filePaths = filePaths.replaceAll("\\r?\\n", ",");
filePaths = filePaths.replaceAll(",+", ",");
String sourceText = configuration.getSourceText();
try {
Reader reader = new StringReader(sourceText);
files.addAll(Arrays.asList(new ReaderDataSource(reader, filePaths)));
} catch (Exception e) {
LOGGER.error(ValueUtil.toString(e));
}
}
return files;
}
Aggregations