-
Notifications
You must be signed in to change notification settings - Fork 112
Fix ignoring lambda expression in C++ plugin #816
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
Conversation
a5a5b30 to
fbd2cdf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the cppmetrics-ignore-lambdas flag to properly exclude functions inside lambda objects from metrics calculations. Previously, function-level metrics (McCabe complexity and Bumpy Road) were incorrectly calculated for functions inside anonymous lambda objects.
Key changes:
- Added
inLambdaObjectfield toCppFunctionmodel to track if a function is inside a lambda - Introduced
getFunctionQuery()template method to apply lambda filtering when the flag is set - Refactored
typeMcCabe()to useCohesionCppRecordViewfor more consistent type querying
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
plugins/cpp/model/include/model/cppfunction.h |
Added inLambdaObject boolean field to track lambda membership |
plugins/cpp/parser/src/clangastvisitor.h |
Set inLambdaObject flag when parsing method declarations inside lambda classes |
plugins/cpp_metrics/parser/include/cppmetricsparser/cppmetricsparser.h |
Added getFunctionQuery() template to filter lambda functions based on configuration |
plugins/cpp_metrics/parser/src/cppmetricsparser.cpp |
Applied getFunctionQuery() to functionMcCabe() and functionBumpyRoad(), refactored typeMcCabe() to use CohesionCppRecordView |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
plugins/cpp_metrics/parser/include/cppmetricsparser/cppmetricsparser.h
Outdated
Show resolved
Hide resolved
141df43 to
5f4af75
Compare
Previously, we calculated metrics for functions inside anonymous lambda objects. This has now been fixed.
5f4af75 to
0a2ae4d
Compare
mcserep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@barnabasdomozi Thanks for the requested explanations on the changes, LGTM! 🚀
Previously, we calculated metrics for functions inside anonymous lambda objects. This has now been fixed.