Idean / sonar-swift

Open source Swift plugin for SonarQube (also supports Objective-C)
Other
895 stars 278 forks source link

Getting error (java.lang.StringIndexOutOfBoundsException) while runnung the script: run-sonar-swift.sh #235

Open malikubaid opened 5 years ago

malikubaid commented 5 years ago

Describe the bug Getting following error while running run-sonar-swift.sh, while parsing report.

java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 11 at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source) at java.base/java.lang.String.substring(Unknown Source) at com.backelite.sonarqube.swift.complexity.LizardReportParser$SwiftFunction.(LizardReportParser.java:181) at com.backelite.sonarqube.swift.complexity.LizardReportParser.parseMeasure(LizardReportParser.java:120) at com.backelite.sonarqube.swift.complexity.LizardReportParser.parseFile(LizardReportParser.java:88) at com.backelite.sonarqube.swift.complexity.LizardReportParser.parseReport(LizardReportParser.java:68) at com.backelite.sonarqube.swift.complexity.LizardSensor.execute(LizardSensor.java:63) 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:359) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:354) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:317) 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:128) 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)

To Reproduce Steps to reproduce the behavior: Run script : run-sonar-swift.sh

SonarQube environment: Sonarqube => version - 7.7 (community edition) OS => Darwin Macbooks-MacBook-Pro-21.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_6

davidy4ng commented 5 years ago

Something wrong with the Lizard report parser.

If you can work without the lizard report for now until a fix is available, just try to disable lizard or remove the lizard-report.xml file in your sonar-reports/ folder.

Your analysis will then continue.

neufeng commented 5 years ago

After remove lizard-report.xml, file not found exception will be there

davidy4ng commented 5 years ago

Ok. But the analysis should have worked and reach the end, you get the same behavior as if you chose to skip the lizard analysis.

What I suggested is just a workaround, in case you don't need the lizard report. The Lizard report parser still need a fix.

gaelfoppolo commented 5 years ago

What is your Lizard version? Could you provide a sample lizard-report.xml?