Skip to content
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

Added calculation for afferent coupling of types #757

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kmkristof
Copy link
Collaborator

@kmkristof kmkristof commented Jul 1, 2024

Closes #671

I added a calculation for the type level afferent coupling metric based on @intjftw's solution in #711.

TODO:

  • tests

@mcserep mcserep requested a review from intjftw July 1, 2024 13:43
@mcserep mcserep linked an issue Jul 1, 2024 that may be closed by this pull request
@mcserep mcserep added Kind: Enhancement 🌟 Status: WIP 👷 Issue or PR under development - feel free to review, though! Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin. labels Jul 1, 2024
@mcserep mcserep added this to the Upcoming Release milestone Jul 1, 2024
@mcserep
Copy link
Collaborator

mcserep commented Jul 1, 2024

@intjftw Since you have worked on efferent coupling in #711, I suggest you to review it, when this PR will be ready.

@kmkristof kmkristof marked this pull request as ready for review July 1, 2024 13:51
@mcserep
Copy link
Collaborator

mcserep commented Jul 1, 2024

@kmkristof Since the development of this new metric was started after Implementation of C++ metrics parallelization (see #734) was merged, I suggest to implement this metric with multithread computation on the first attempt, based on the already implemented pattern.

We can consider this task as Level: Intermediate (3) with this added complexity.

Comment on lines 121 to 126
for (const model::CppMemberType& member : _ctx.db->query<model::CppMemberType>(
odb::query<cc::model::CppMemberType>::typeHash == type.entityHash &&
odb::query<cc::model::CppMemberType>::kind == model::CppMemberType::Kind::Field))
{
typesFound.insert(member.memberTypeHash);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My current solution is not complete. This coupling is not only defined by member fields but also by function parameters, inheritance relations etc. Please complement this calculation accordingly.

@intjftw intjftw self-requested a review July 8, 2024 22:25
Copy link
Collaborator

@intjftw intjftw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing with TinyXML2, the records in the db contain 0 for the AST node ID for afferent coupling. Another issue is that all afferent coupling records are persisted multiple times (or at least I think I'm discovering a pattern in the data, but the same series of stored metrics seem to be duplicated several times). Also, the afferent metrics are not present in the service component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind: Enhancement 🌟 Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin. Status: WIP 👷 Issue or PR under development - feel free to review, though!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Afferent Coupling at Type Level for C++
3 participants