sonar-flutter icon indicating copy to clipboard operation
sonar-flutter copied to clipboard

[FATAL] pubspec.yaml does not exist in Monorepository

Open santitigaga opened this issue 1 year ago • 0 comments

Problem

if you try to analyze the project in the root folder of the repository it will fail because the sensorContext is located from where the sonar-scanner is executed.

INFO: Sensor Dart sensor [flutter] (done) | time=3494ms
INFO: Sensor Dart pubspec.yaml sensor [flutter]
INFO: Sensor Dart pubspec.yaml sensor [flutter] (done) | time=4ms
INFO: Sensor Dart analysis sensor [flutter]
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 32.165s
INFO: Final Memory: 65M/224M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner execution
##[error]java.lang.IllegalArgumentException: /home/pubspec.yaml does not exist

java.lang.IllegalArgumentException: /home/pubspec.yaml does not exist
##[error]at fr.insideapp.sonarqube.dart.lang.PubSpecParser.parse(PubSpecParser.java:49)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:66)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at fr.insideapp.sonarqube.dart.lang.PubSpecParser.parse(PubSpecParser.java:49)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:66)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
...

Temporary

A possible solution is to add the property sonar.projectBaseDir property in the sonar-scanner properties, at least while it is set to support executions outside this context.

santitigaga avatar Apr 16 '24 22:04 santitigaga