In some other project the cognitive complexity drop from 3K to ~100.
This happened in several project across several teams during the month of January.
Context:
All the projects are “single” language (ts, js)
It is all analyzed in the Github Action pipelines
We are using the official runner updated automatically using dependabot
No changes were done in the quality gates or configurations in sonarcloud.
Not really. Everything else looks normal, probably that is why it went so long unnoticed.
We are just very confused, because this happened in several projects around the same time. These projects are managed by different teams and each manage its pipelines and it sonarcloud configuration independently.
I wasn’t able to find much information in google. I found 2 issues reported in this forum, one about sonarcloud and another for sonarqube.
Hi G Ann Campbell,
Thank you for following up. I cannot share many of the files content, but I found an easy example where the complexity should be higher than 0:
Thank you for following up and sorry for the misunderstanding. Yes, the analysis says that all files (inclusive this one) has 0 complexity. The only file in the project that has anything greater than zero is the main.ts (that has 1). It is as if no file are really scanned.
Here is the screenshot of this file in sonarcloud.
Thanks for the logs, code sample and screenshot, we are looking at your issue and it helps a lot.
Is the Cyclomatic Complexity metric impacted too?
Could you also provide the date of the point, in your first graph, that is just after the 11th of January; the one where the value dropped for the first time to something close to 0?
Hi Eric,
Thank you the follow up. Only the cognitive complexity drop to 0.
I cannot give a better date, as in the project was not much activity during January and February. I post below some more detail graph.
I hope this help. In the meanwhile all our ts files are reporting 0 cognitive complexity. Even in mixed projects, the ts files are contributing 0 to the cognitive complexity. Just for the record, I’ve also set back all the changes in the quality gates to the sonar way, to avoid any problem coming from configurations.
I’m quite sure that there is a bug in the software. Just a few ideas that cross my mind, I don’t remember when came the update for the github action runner, but it might be related to that update (somehow I have in my memory that that happened around that time).
This had a side effect on the way we compute CC at a file level that we did not anticipate. We will dive into it and come back with a solution proposal.