Sonarqube bitbucket ci/cd issue for version upgrade

Upgrade the version of my sonarqube from 9.6.1-community to version 10.1-community.
and using bitbucket CI/CD,

image: cirrusci/flutter:stable

pipelines:
  branches:
    infra-devops:
    - step:
        name: Build and Test
        script:
          - git submodule update --init --recursive

    - step:
        name: SonarQube Analysis
        script:
          - apt-get update && apt-get install -y openjdk-17-jre
          - curl --create-dirs -sSLo /sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472.zip
          - unzip -q /sonar-scanner-cli.zip -d /sonar-scanner
          - export PATH=$PATH:/sonar-scanner/sonar-scanner-4.6.2.2472/bin
          - apt-get install -y nodejs
          - apt-get install -y apt-transport-https
          - flutter doctor  -v 
          - flutter clean 
          - flutter pub get 
          - dart analyze  
          - sonar-scanner -Dsonar.login="$SONAR_TOKEN" -Dsonar.host.url="$SONAR_HOST_URL"

and when running pipeline getting we are getting this error

INFO: Sensor Dart analysis sensor [flutter]
INFO: Detected Flutter project with version 1.0.0+1
INFO: Backup of original analysis_options.yaml file to analysis_options.yaml.sonar
INFO: Running 'flutter [analyze, --no-fatal-warnings, --no-fatal-infos]'
INFO: Command 'flutter analyze --no-fatal-warnings --no-fatal-infos' finished (exit 1)
INFO: Restored original analysis_options.yaml file
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:21.199s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 31M/107M
INFO: ------------------------------------------------------------------------
java.lang.IllegalStateException: Error while running 'flutter analyze --no-fatal-warnings --no-fatal-infos' (exit 1): 4578 issues found. (ran in 17.3s)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.maybeThrowException(AnalyzerExecutable.java:103)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.analyze(AnalyzerExecutable.java:91)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:67)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Please let us know if there is any solutions for this to resolve.
Thanks in advance.

1 Like

Hi,

This error is coming from the 3rd-party Flutter analyzer. You’re going to need to take it up with the plugin’s maintainers.

 
:frowning:
Ann

i am getting a same error. i have followed this tutorial Static Code Analysis with SonarQube with Flutter | by Arindam Ghosh | Medium

sonar-projects.properties

sonar.projectKey=my project key
sonar.projectName=my project name
sonar.login=token
sonar.host.url=http://localhost:9000
sonar.sources=lib
sonar.tests=test
sonar.sourceEncoding=UTF-8
sonar.exclusions=test/**/*_test.mocks.dart,lib/**/*.g.dart

when I run sonar-scanner , its giving below error, though same sonar-project.properties file working file with other projects.

INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=28ms
INFO: Load/download plugins (done) | time=662ms
INFO: Process project properties
INFO: Process project properties (done) | time=5ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: pinpoint-fl-app
INFO: Base dir: /home/paranjay-patel-us/Development/projects/logicwind/pinpoint/pinpoint-fl-app
INFO: Working dir: /home/paranjay-patel-us/Development/projects/logicwind/pinpoint/pinpoint-fl-app/.scannerwork
INFO: Load project settings for component key: 'pinpoint-fl-app'
INFO: Load project settings for component key: 'pinpoint-fl-app' (done) | time=17ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=39ms
INFO: Load active rules
INFO: Load active rules (done) | time=1265ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=5ms
WARN: The property 'sonar.login' is deprecated and will be removed in the future. Please use the 'sonar.token' property instead when passing a token.
INFO: Load project repositories
INFO: Load project repositories (done) | time=15ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: test/**/*_test.mocks.dart, lib/**/*.g.dart
INFO: 85 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for dart: dartanalyzer
INFO: ------------- Run sensors on module pinpoint-fl-app
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=13ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=1ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=8ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor Dart sensor [flutter]
WARN: Duplication reported for 'test/widget_test.dart' will be ignored because it's a test file.
INFO: Sensor Dart sensor [flutter] (done) | time=475ms
INFO: Sensor Dart pubspec.yaml sensor [flutter]
INFO: Sensor Dart pubspec.yaml sensor [flutter] (done) | time=1ms
INFO: Sensor Dart analysis sensor [flutter]
INFO: Detected Flutter project with version 1.0.0+1
INFO: Backup of original analysis_options.yaml file to analysis_options.yaml.sonar
INFO: Running 'flutter [analyze, --no-fatal-warnings, --no-fatal-infos]'
INFO: Command 'flutter analyze --no-fatal-warnings --no-fatal-infos' finished (exit 1)
INFO: Restored original analysis_options.yaml file
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 12.908s
INFO: Final Memory: 30M/120M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Error while running 'flutter analyze --no-fatal-warnings --no-fatal-infos' (exit 1): 6640 issues found. (ran in 6.7s)

        at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.maybeThrowException(AnalyzerExecutable.java:103)
        at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.analyze(AnalyzerExecutable.java:91)
        at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:67)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
        at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
        at org.sonarsource.scanner.cli.Main.main(Main.java:62)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.