-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cognitive complexity metric does not understand newer C++ syntax #2672
Comments
Hello @Patschkowski, thanks for the feedback … |
Hi @Patschkowski, most likely the problem is somewhere here: https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-squid/src/main/java/org/sonar/cxx/visitors/CxxCognitiveComplexityVisitor.java Can you confirm, that it’s a problem with cognitive complexity? Regards, |
Hi @guwirth , I'd say it is Cyclomatic Complexity |
Hello @Patschkowski, there are metrics (Measues) and rule violations (Issues) in SonarQube. The first screenshot you sent seems to show the cognitive complexity metric. The second one is a complexity rule violation. These are two different things created in a different way. Also the visitor verifying the AST is for cognitive and cyclomatic complexity a different one. The reason why I’m asking is to narrow down the problem. Regards, |
Hi @guwirth appreciate your explanation. I think it is the Cyclomatic Complexity though: |
Hi @Patschkowski, thx for clarification! Can you copy me the source code of this one template Regards, |
|
Think problem is that CxxCognitiveComplexityVisitor.java is using |
- fix problem with r-value reference - close SonarOpenCommunity#2672
@Patschkowski fixed with #2675, you can test it with https://github.com/SonarOpenCommunity/sonar-cxx/releases/tag/latest-snapshot |
Describe the bug
Code complexity metric is counting r-value references as logical operators and "=default" as switch labels.
Expected behavior
Code complexity metric does not count r-value references as logical operators and "=default" as switch labels.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: