-
Notifications
You must be signed in to change notification settings - Fork 102
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
Lack of cohesion metrics #688
Conversation
Renamed view types.
…for internal types. Record access is now done via a specialized view. Minor refactor (code duplication fix) in the file location recording in the AST visitor.
…he metrics parser).
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.
@@ -15,13 +17,27 @@ | |||
|
|||
#include <memory> | |||
|
|||
// Controls whether cohesion metrics are printed to the output | |||
// immediately as they are being calculated. | |||
#define DEBUG_COHESION_VERBOSE |
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.
I don't really see the point of this macro symbol in its current form. It's always defined, independent of the loglevel
switch so the following statements between #ifdef
and #endif
macros are executed anyway. It would make more sense if the definition of this symbol depended on the --loglevel=debug
command line argument.
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.
I agree with @intjftw , we already use Boost's log library, no need for these macros. If you wouldn't like to include all these messages to the debug
log, there is even a trace
log level below it, which can be used.
plugins/cpp_metrics/parser/include/cppmetricsparser/cppmetricsparser.h
Outdated
Show resolved
Hide resolved
Something I noticed running the plugin in debug mode: it seems that one AST node is calculated multiple times: 2023-12-11 11:41:59 [DEBUG] 498/527 tinyxml2::MemPoolT::Item 0 0
2023-12-11 11:41:59 [DEBUG] 499/527 tinyxml2::MemPoolT::Block 0 0
2023-12-11 11:41:59 [DEBUG] 500/527 tinyxml2::MemPoolT 0.625 0.6818
2023-12-11 11:41:59 [DEBUG] 501/527 tinyxml2::MemPoolT 0.7083 0.7727
2023-12-11 11:41:59 [DEBUG] 502/527 tinyxml2::MemPoolT 0.7083 0.7727
2023-12-11 11:41:59 [DEBUG] 503/527 tinyxml2::MemPoolT 0.7083 0.7727
2023-12-11 11:41:59 [DEBUG] 504/527 tinyxml2::MemPoolT 0.7083 0.7727 @dbukki is this an error or just something with the debug log? |
I am currently investigating this strange phenomenon too. My initial guess is that these are actually different instantiations of the same templated type, and some of them are specializations that have a different number of fields and methods. It could also be that types defined in a header and included by multiple compilation units each have their own copy of this type in the database. And then it's also possible that both of the above factors play a role in this output. I have yet to figure out a full diagnosis. |
Fixed the casing and naming of debug utility variables in the LoC parser.
Renamed view types.
…for internal types. Record access is now done via a specialized view. Minor refactor (code duplication fix) in the file location recording in the AST visitor.
…he metrics parser).
Fixed the casing and naming of debug utility variables in the LoC parser.
Explicit edge cases in LoC formulas.
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.
The most critical point is the test failure in the CI. If that's corrected, I say we merge the PR, and clean up a few things afterwards. @mcserep what do you think?
# Conflicts: # plugins/cpp_metrics/parser/include/cppmetricsparser/cppmetricsparser.h # plugins/cpp_metrics/parser/src/cppmetricsparser.cpp # util/include/util/filesystem.h
Introduction of Lack of Cohesion (LoC) metrics in the metrics plugin.
Fixes #681.