I’ve set up two iOS app projects in Sonarqube Cloud (free tier) and they both show Cyclomatic Complexity scores under the Measures section. However, I’m keen to see the Cognitive Complexity but they do not appear at all. Is this a limitation of the free tier or is there some configuration I need to enable?
Hi,
Welcome to the community and thanks for this report!
While Cognitive Complexity is a choice metric* we don’t restrict it to premium accounts. There’s no reason you shouldn’t be seeing this. Can I get a screenshot of where you’re looking for it, and a debug analysis log?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Ann
*I’m the primary author
Hi Ann, thank you for responding. I hope I obtained the right log you requested. Here is the screenshot. I was expecting to see Cognitive Complexity under the “Complexity” section along with Cyclomatic Complexity, within Measures. Both my iOS projects do not show Cognitive. I’m hoping my app isn’t considered so simple that even an ant could understand it so it didn’t bother showing!
Appreciate you looking into this.
sonarqube-iosapp-scan-log.txt (428.7 KB)
Hi,
Thanks for the log. It looks super-normal. So I went back to the team because surely we’ve implemented Cognitive Complexity for Swift, right?
Yes. Yes we did. … In the old analyzer. We’re completely reimplementing Swift analysis though, and while we’re currently working on (re)implementing Cognitive Complexity, we’re not there yet. So if you’re on SonarQube Cloud, unless you’re analyzing on Windows (which falls back to the old analyzer) you don’t have Cognitive Complexity right now. But it’s coming.
HTH,
Ann
Hi again,
I mentioned analysis on Windows. It was pointed out to me that I should also mention that’s deprecated and will go away at the end of June.
Ann
Thanks, Ann.
Are you able to share an approximate date (month or quarter) of when it will be available on Cloud? (I’m on Mac)
Also, is it available for .NET MAUI (C#) in Cloud or in local Community Edition?
Hi,
The next update to the analyzer should include Cognitive Complexity, so look for it… let’s say mid-April.
As I said, .NET analysis is deprecated. It has Cognitive Complexity because the rewritten analyzer doesn’t support .NET & so for now .analysis on NET falls back to the old analyzer. But that won’t last.
HTH,
Ann
Hi again,
Did you mean “Is Cognitive Complexity available for C#?”. Then yes.
Sorry for the confusion!
Ann
Hi Ann, yes I meant C# (language that .NET MAUI mobile apps are written in). Thanks for clarifying.
