Swift analyzer error on new Swift 4.2 Syntax

The new Swift 4.2 Syntax includes new best practices for the weak/strong management in closures. Guarding for a strong reference to self is done like this:

guard let self = self else { return }

This gives in the newest version of the scanner an error:

String is not parsed
...
guard let self = self else { return }

Expected Behaviour
The syntax should be valid, as it is a new feature and best practice.

Please add support for this new syntax.

2 Likes

SONARSWIFT-421

2 Likes

Any chance this issue will be resolved any time soon? Our team evaluating SonarCloud to use for monitoring quality in iOS project, and as parses fails to recognize this syntax: “guard let self = self else { return }” making Scanner useless without the fix.

any work-around would be much appreciated.

2 Likes

Were using sonar-scanner 4.2.0.1873 and the issue still occurs.
We upgraded to 4.3.0.2102 but the error remains.

2 Likes

Also seeing this with: SonarScanner 4.4.0.2170

@Colin looks like it’s been reported a few times since SONARSWIFT-421 any chance someone will look at it?

1 Like

@Ray Can you confirm what version of the Swift analyzer is installed on your SonarQube instance, upgrade it if it is less than v4.2.2 – and if the problem persists, provide a code sample?