File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
sonar-swift-plugin/src/main/java/com/backelite/sonarqube/swift/complexity Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 2828import org .sonar .api .batch .sensor .SensorDescriptor ;
2929
3030import java .io .File ;
31+ import java .io .IOException ;
32+ import java .nio .file .Files ;
33+ import java .nio .file .Path ;
34+ import java .nio .file .Paths ;
3135
3236public class LizardSensor implements Sensor {
3337 private static final Logger LOGGER = LoggerFactory .getLogger (LizardSensor .class );
@@ -56,10 +60,14 @@ public void describe(SensorDescriptor descriptor) {
5660
5761 @ Override
5862 public void execute (SensorContext context ) {
59- String reportFileName = context .fileSystem ().baseDir ().getPath () + File .separator + reportPath ();
60- LOGGER .info ("Processing complexity report: {}" ,reportFileName );
63+ File reportFile = new File (context .fileSystem ().baseDir (), reportPath ());
64+ if (!reportFile .isFile ()) {
65+ LOGGER .warn ("Lizard report file not found at {}" , reportFile .getAbsolutePath ());
66+ return ;
67+ }
6168
69+ LOGGER .info ("Processing complexity report: {}" , reportFile .getAbsolutePath ());
6270 LizardReportParser parser = new LizardReportParser (context );
63- parser .parseReport (new File ( reportFileName ) );
71+ parser .parseReport (reportFile );
6472 }
6573}
You can’t perform that action at this time.
0 commit comments