Missing code smell for "Classes should not have too many methods" in Pull request analysis

In one of our projects, there are some examples of classes that have too many functions, which triggers https://rules.sonarsource.com/cpp/RSPEC-1448 And this is an issue that exists on the main branch. However, in a pull request analysis, it appears that this issue is not reported when though the merge request is introducing a new function to one of these classes.

It seems inconsistent to not generate a report on this issue when the report includes smells for https://rules.sonarsource.com/cpp/RSPEC-3776 when you touch a function that already triggers this rule.


Thanks for the report. I understand your position, and it makes sense.

And unfortunately, this is about the… structure of the rule

In PR analysis, we suppress reporting of issues on old code, and that rule raises its issues at the class declaration, which is old code.

For issues with secondary locations, I believe we do report issues in PR analysis when a secondary location is on new code. But that rule doesn’t have secondary locations - partly because it was implemented before we started reporting secondary locations, and partly because it would just be irritating to put a secondary location on every. single. method. in. the. class.