Error during SonarQube Scanner execution for swift project-Metric 'files' should not be computed by a Sensor

Error during SonarQube Scanner execution for swift project

  • versions used - 4.2.0
  • error observed

ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedOperationException: Metric ‘files’ should not be computed by a Sensor
at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(DefaultSensorStorage.java:173)
at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:137)
at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(DefaultMeasure.java:96)
at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
at com.backelite.sonarqube.commons.MeasureUtil.saveMeasure(MeasureUtil.java:34)
at com.backelite.sonarqube.swift.SwiftSquidSensor.saveMeasures(SwiftSquidSensor.java:85)
at com.backelite.sonarqube.swift.SwiftSquidSensor.save(SwiftSquidSensor.java:79)
at com.backelite.sonarqube.swift.SwiftSquidSensor.execute(SwiftSquidSensor.java:141)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
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 com.sun.proxy.$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 SonarQube Scanner using the -X switch to enable full debug logging.

  • returnValue=1
  • set +x
    ERROR - Command 'sonar-scanner ’ failed with error code: 1

Do you have any other plugins on your SonarQube instance intended to analyze Swift? There are reports of this error on community-supported plugins, but not SonarSource’s Swift analyzer.

Edit: In fact, you definitely do!

at com.backelite.sonarqube.commons.MeasureUtil.saveMeasure(MeasureUtil.java:34)
at com.backelite.sonarqube.swift.SwiftSquidSensor.saveMeasures(SwiftSquidSensor.java:85)
at com.backelite.sonarqube.swift.SwiftSquidSensor.save(SwiftSquidSensor.java:79)
at com.backelite.sonarqube.swift.SwiftSquidSensor.execute(SwiftSquidSensor.java:141)

You should update your version of this plugin.

SonarSource also supports a first-party Swift analyzer, with Developer Edition+ ($)

my SonarQube instance looks like below

After using updated plugin version also I am getting the same error.
And SonarSource also supports a first-party Swift analyzer ? means ?

You should raise an issue at Idean/sonar-swift.

Swift language analysis is supported first-party (by SonarSource, who makes SonarQube) in the Developer Edition of SonarQube, and free on https://sonarcloud.io for open-source projects.