SonarSwift - Swift 4.2 issue

Good time of the day Sonar Team!

We are evaluating SonarCloud for commercial license use in our organization, particularly to analyze code of iOS application as a part of the build process, and came across the issue with the SonarSwift that would be blocking us from being able to use the product. Particularly failure for parser to process following syntax: guard let self = self else { return }
Of VSTS task: “Run Code Analysis”
It seems to be related to the issue https://jira.sonarsource.com/projects/SONARSWIFT/issues/SONARSWIFT-421 which has been opened in January and remains open to this day.
Until issue is resolved we won’t be able to use the product and will have to cancel the trial.
Would you be able to provide any guidance about particular issue or if possible provide a work-around, so we can continue evaluation of your production?

In attempt to find a work-around issue with SonarSwift I was able to run a swift analysis using run-sonar-swift.sh from Backelite project… but not sure if i’ll able to import scan results into SonarCloud without a Backelite plugin.

Hello,

Indeed looks like it’s the same problem as in the ticket you mentioned, I’ve added your code example there. For the workaround I can only suggest you to rewrite the code the way that avoid such constructions.

I’m not sure how run-sonar-swift.sh works, but indeed community plugins are not installed on SonarCloud. But may be you can find a way to import their issues as external.

Hello,

It’s been a while since you opened this thread, but I wanted to let you know that the issue you mention has been solved in the latest version of the Swift plugin (SonarSwift 4.2), which is available on SonarCloud.

Hope that helps,
Guillaume

1 Like