Sudden Increase in Bugs and Errors indications

Since October 3, we’ve noticed a significant increase in bug and error indications across our projects. We’re not sure what caused this sudden spike, it looks like a rule changes or something in this area, because it alerts us on old code that didn’t change for a while.

Can you help us understand the root cause?

Hey there!

Can you give some examples of the rules/issues that are being raised that weren’t before? That would help to correlate it to a specific change :slight_smile:

Some examples:

  • Prefer `Math.max()` to simplify ternary expressions
  • Use `for…of` instead of `.forEach(…)`.
  • Do not call `Array#push()` multiple times.

How about some specific Rule IDs. It woud help a lot :slight_smile:

javascript:S7766
javascript:S7728
javascript:S7778

These recently added rules are now part of SonarQube Cloud. You can track changes to your Quality Profile directly in the UI.

If you prefer more control over when new rules are introduced, consider not using the default Sonar Way quality profile. Instead, copy the profile and periodically review or compare it in the UI to manage changes yourself.

Thank you, Colin!
We’ve also encountered two other problems:

  1. Sonar initially flagged some issues, but after re-running the scan, it suddenly stopped reporting them.
  2. Sonar is alerting about issues in files that we did change, but it’s warning us about lines that we didn’t modify in this specific PR.

This probably happened when we initially had to revert the rules and add them back.

Is the behavior stable now?

Has your main branch been reanalyzed?

FYI, I’m not a fan of the user experience here when we add a lot of rules at once (especially raising issues in PR on old code) and this is a topic we’re discussing internally.

1 Like
  1. Got it regarding the reverted rules. I think it’s stable now, but I’ll need a few days of tracking to be sure.
  2. I haven’t re-analyzed my main branch yet. Could you please walk me through how to do it?

Typically that just requires a simple commit to your main branch.

Are you using CI/CD-based analysis? Or Automatic Analysis?

There’s a bit of a chicken / egg issue here (normally you would analyze your main branch after merging a PR… but now PR analysis is raising issues on old code and failing your QG).