|
26 | 26 | import org.sonar.api.batch.sensor.SensorContext;
|
27 | 27 | import org.sonar.api.batch.sensor.SensorDescriptor;
|
28 | 28 | import org.sonar.api.config.Configuration;
|
29 |
| -import org.sonar.api.utils.WildcardPattern; |
30 | 29 | import org.sonar.api.utils.log.Logger;
|
31 | 30 | import org.sonar.api.utils.log.Loggers;
|
32 | 31 | import org.sonar.plugins.python.warnings.AnalysisWarningsWrapper;
|
| 32 | +import org.sonarsource.analyzer.commons.FileProvider; |
33 | 33 |
|
34 | 34 | public abstract class PythonReportSensor implements Sensor {
|
35 | 35 |
|
@@ -69,23 +69,23 @@ public void execute(SensorContext context) {
|
69 | 69 | public static List<File> getReports(Configuration conf, String baseDirPath, String reportPathPropertyKey, String reportPath) {
|
70 | 70 | LOG.debug("Using pattern '{}' to find reports", reportPath);
|
71 | 71 |
|
72 |
| - DirectoryScanner scanner = new DirectoryScanner(new File(baseDirPath), WildcardPattern.create(reportPath)); |
73 |
| - List<File> includedFiles = scanner.getIncludedFiles(); |
| 72 | + FileProvider provider = new FileProvider(new File(baseDirPath), reportPath); |
| 73 | + List<File> matchingFiles = provider.getMatchingFiles(); |
74 | 74 |
|
75 |
| - if (includedFiles.isEmpty()) { |
| 75 | + if (matchingFiles.isEmpty()) { |
76 | 76 | if (conf.hasKey(reportPathPropertyKey)) {
|
77 | 77 | // try absolute path
|
78 | 78 | File file = new File(reportPath);
|
79 | 79 | if (!file.exists()) {
|
80 | 80 | LOG.warn("No report was found for {} using pattern {}", reportPathPropertyKey, reportPath);
|
81 | 81 | } else {
|
82 |
| - includedFiles.add(file); |
| 82 | + matchingFiles.add(file); |
83 | 83 | }
|
84 | 84 | } else {
|
85 | 85 | LOG.debug("No report was found for {} using default pattern {}", reportPathPropertyKey, reportPath);
|
86 | 86 | }
|
87 | 87 | }
|
88 |
| - return includedFiles; |
| 88 | + return matchingFiles; |
89 | 89 | }
|
90 | 90 |
|
91 | 91 | protected void processReports(SensorContext context, List<File> reports) throws javax.xml.stream.XMLStreamException {
|
|
0 commit comments