|
26 | 26 | import java.nio.file.Paths; |
27 | 27 | import java.util.ArrayList; |
28 | 28 | import java.util.List; |
| 29 | +import java.util.Set; |
29 | 30 | import org.pqca.errors.ClientDisconnected; |
30 | 31 | import org.pqca.indexing.ProjectModule; |
31 | 32 | import org.pqca.progress.IProgressDispatcher; |
|
36 | 37 | import org.pqca.scanning.ScannerService; |
37 | 38 | import org.sonar.api.batch.fs.InputFile; |
38 | 39 | import org.sonar.api.batch.fs.internal.DefaultFileSystem; |
| 40 | +import org.sonar.api.batch.sensor.SensorContext; |
39 | 41 | import org.sonar.api.batch.sensor.internal.SensorContextTester; |
40 | 42 | import org.sonar.api.config.internal.MapSettings; |
| 43 | +import org.sonar.api.issue.NoSonarFilter; |
41 | 44 | import org.sonar.api.measures.FileLinesContext; |
42 | 45 | import org.sonar.api.measures.FileLinesContextFactory; |
43 | 46 | import org.sonar.java.DefaultJavaResourceLocator; |
44 | 47 | import org.sonar.java.JavaFrontend; |
| 48 | +import org.sonar.java.Measurer; |
45 | 49 | import org.sonar.java.SonarComponents; |
46 | 50 | import org.sonar.java.classpath.ClasspathForMain; |
47 | 51 | import org.sonar.java.classpath.ClasspathForTest; |
48 | 52 | import org.sonar.java.model.JavaVersionImpl; |
| 53 | +import org.sonar.java.telemetry.NoOpTelemetry; |
49 | 54 | import org.sonar.plugins.java.api.JavaResourceLocator; |
50 | 55 | import org.sonar.plugins.java.api.JavaVersion; |
51 | 56 |
|
@@ -154,7 +159,8 @@ public synchronized ScanResultDTO scan(@Nonnull List<ProjectModule> index) |
154 | 159 | new JavaFrontend( |
155 | 160 | JAVA_VERSION, |
156 | 161 | sonarComponents, |
157 | | - null, |
| 162 | + getMeasurer(sensorContext), |
| 163 | + new NoOpTelemetry(), |
158 | 164 | javaResourceLocator, |
159 | 165 | null, |
160 | 166 | new JavaDetectionCollectionRule(this)); |
@@ -222,6 +228,18 @@ public void save() { |
222 | 228 | null); |
223 | 229 | } |
224 | 230 |
|
| 231 | + @Nonnull |
| 232 | + private static Measurer getMeasurer(SensorContext context) { |
| 233 | + return new Measurer( |
| 234 | + context, |
| 235 | + new NoSonarFilter() { |
| 236 | + @Override |
| 237 | + public NoSonarFilter noSonarInFile(InputFile arg0, Set<Integer> arg1) { |
| 238 | + return null; |
| 239 | + } |
| 240 | + }); |
| 241 | + } |
| 242 | + |
225 | 243 | // private String findClassDirs() { |
226 | 244 | // try (Stream<Path> stream = Files.walk(this.projectDirectory.toPath())) { |
227 | 245 | // return String.join( |
|
0 commit comments