We are making use of Swift 5.7 (Swift.org - Swift 5.7 Released!) and the “New shorthand syntax for common boilerplate code, including if let statements and multi-statement closure type annotations”.
As seen on Swift | SonarCloud Docs, SonarCloud only supports Swift 3 up to Swift 5.6 at the moment.
At the moment, we are getting “ERROR: String is not parsed” errors in the SonarCloud Analysis when making use of new unwrapping syntax in Swift 5.7.
Ironically I haven’t seen anymore false positives in this area since I posted, so hopefully it’s fixed now and not that we haven’t hit this again since. Thanks for the response though
Hi guys,
going forward will it stop working always when a new Swift syntax is introduced? It shouldn’t be a problem if the “problematic” part is skipped but we experienced a different behavior; the tool failed to complete the analysis and always exited with an error.
Hi @janc, thank you for your feedback, and welcome to the Sonar community!
As you probably guessed, the Swift analyzer has a parser that follows the versions of Swift. And after the announcement of a new version, we need to implement the new language constructs.
Unfortunately, the parser can’t recover from a parsing error. So, a file using features introduced after the latest version of Swift supported in SonarCloud may generate errors, and the analysis will then stop for that file.