Open onmyway133 opened 5 years ago
Thanks man for all the tipps, was lost editing properties... Unfortunately, the hack for the "Metric 'files' should not be computed by a Sensor" did not work... commented out the line in both files, compiled with maven but get the same issue.
I am getting LizardReportParser$SwiftFunction cannot be cast
error. What do you mean run lizard manually? Even if we run it manually, next sonarqube scan fails with the same error and no reports get uploaded to the server.
@onmyway133 You may want to look at (and add in your guide) https://github.com/Backelite/sonar-swift/issues/225#issuecomment-497445343 for "LizardReportParser$SwiftFunction cannot be cast" error.
I tried out theMetric 'files' should not be computed by a Sensor
workaround, but I'm getting a different error now:
ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedOperationException: Can not add the same measure twice on Source/XXXX/XXXX.swift: DefaultMeasure[component=Source/XXXX/XXXX.swift,metric=Metric[id=<null>,key=ncloc,description=Non commenting lines of code,type=INT,direction=-1,domain=Size,name=Lines of Code,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>],value=6,fromCore=false]
at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(DefaultSensorStorage.java:172)
at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:132)
at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(DefaultMeasure.java:95)
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:86)
at com.backelite.sonarqube.swift.SwiftSquidSensor.save(SwiftSquidSensor.java:79)
at com.backelite.sonarqube.swift.SwiftSquidSensor.execute(SwiftSquidSensor.java:140)
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:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
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:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
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:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
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)
Any ideas what this could be?
INFO: sonar-scanner-cli-4.0.0.1744-macosx INFO: 12.0.2, x86_64: "Java SE 12.0.2" INFO: Mac OS 10.14.5 INFO: sonarqube-developer-7.9.1
when these fixes will be merge into repository? anyone have any idea.
Hi I am facing an issues as
15:30:48.346 INFO: ------------------------------------------------------------------------
15:30:48.346 INFO: EXECUTION FAILURE
15:30:48.346 INFO: ------------------------------------------------------------------------
15:30:48.346 INFO: Total time: 7.601s
15:30:48.382 INFO: Final Memory: 21M/74M
15:30:48.382 INFO: ------------------------------------------------------------------------
15:30:48.382 ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedOperationException: Can not add the same measure twice on MyStocksPOC/AssetListViewController/AssestListTableViewCells/MyStocks_AssestListTableViewCell.m: DefaultMeasure[component=MyStocksPOC/AssetListViewController/AssestListTableViewCells/MyStocks_AssestListTableViewCell.m,metric=Metric[id=
Can Anyone please help me regarding this?
Install Sonarqube
https://docs.sonarqube.org/latest/setup/get-started-2-minutes/
~/sonarqube
~/sonarqube/bin/macosx-universal-64/sonar.sh console
http://localhost:9000
withadmin/admin
Install Sonar scanner
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
~/sonarscanner
PATH=$PATH:/Users/khoa/sonarscanner/bin
sonar-project.properties
sonar-scanner
Install swift plugin
https://github.com/Backelite/sonar-swift
~/sonarqube/extensions/plugins
Skip some tools
Modify
run-sonar-swift.sh
Git ignore
run-sonar-swift.sh
chmod +x run-sonar-swift.sh
./run-sonar-swift.sh
Troubleshooting
failed with error code: 64 https://github.com/Backelite/sonar-swift/issues/222
When run
./run-sonar-swift.sh
π Remove quotes in
sonar-project.properties
π Modify run-sonar-swift.sh, add these beforeCheck for mandatory parameters
sectionSurround by double quotes
π’ Does not work π Need to create a scheme name without space
Error code 65
πSpecify team in Xcode project
destination
Need double quotes
destinationSimulator="\"$destinationSimulator\""
Use equal sign
=
instead of space ' '
Metric 'files' should not be computed by a Sensor
When run
sonar-scanner
https://github.com/Backelite/sonar-swift/issues/212πInstall maven https://maven.apache.org/download.cgi Edit
ObjectiveCSquidSensor.java
andSwiftSquidSensor
, remove line withCoreMetrics.FILES
Runexport PATH=$PATH:/Users/khoa/apache-maven/bin
Run./build-and-deploy.sh
Or~/apache-maven/bin/mvn clean install
π Built jar is in
sonar-swift-plugin/target/backelite-sonar-swift-plugin-0.4.4.jar
, copy back toextensions/plugins
How to enable SwiftLint as default profile π€
π Need to close current Sonar tab and restart server
Testing failed: unable to attach DB
Modify
run-sonar-swift.sh
to add-UseModernBuildSystem=NO
tobuildCmd+=(-destination
slather No coverage directory found
Try running
π Enable coverage option in scheme -> Test
Optional: declare
.slather.yml
file https://github.com/SlatherOrg/slatherUnable to execute SonarQube
πStart sonar server
LizardReportParser$SwiftFunction cannot be cast
π Run lizard manually