-
Notifications
You must be signed in to change notification settings - Fork 113
Implement efferent coupling at module level #790
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
Merged
mcserep
merged 5 commits into
Ericsson:master
from
barnabasdomozi:efferent_coupling_modules
May 5, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bd60791
Fix CppFunction join type.
f7b0b0a
Implement efferent coupling at module level.
20e0d0d
Add tests for efferent coupling at module level.
f208eb4
Use native COUNT instead of odb::result::size() in metrics calculations.
1ceb98e
Extend module level efferent coupling test cases.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ struct CppFileMetrics | |
| { | ||
| enum Type | ||
| { | ||
| PLACEHOLDER | ||
| EFFERENT_MODULE | ||
| }; | ||
|
|
||
| #pragma db id auto | ||
|
|
||
69 changes: 69 additions & 0 deletions
69
plugins/cpp_metrics/model/include/model/cpptypedependencymetrics.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #ifndef CC_MODEL_CPPTYPEDEPENDENCYMETRICS_H | ||
| #define CC_MODEL_CPPTYPEDEPENDENCYMETRICS_H | ||
|
|
||
| #include <cstdint> | ||
| #include <string> | ||
| #include <model/cppentity.h> | ||
| #include <model/cpprecord.h> | ||
| #include <model/cppastnode.h> | ||
| #include <model/file.h> | ||
|
|
||
| namespace cc | ||
| { | ||
| namespace model | ||
| { | ||
|
|
||
| #pragma db object | ||
| struct CppTypeDependencyMetrics | ||
| { | ||
| #pragma db id auto | ||
| std::uint64_t id; | ||
|
|
||
| #pragma db not_null | ||
| std::uint64_t entityHash; | ||
|
|
||
| #pragma db not_null | ||
| std::uint64_t dependencyHash; | ||
| }; | ||
|
|
||
| #pragma db view \ | ||
| object(CppTypeDependencyMetrics) \ | ||
| object(CppAstNode = EntityAstNode : CppTypeDependencyMetrics::entityHash == EntityAstNode::entityHash \ | ||
| && EntityAstNode::astType == cc::model::CppAstNode::AstType::Definition) \ | ||
| object(File = EntityFile : EntityAstNode::location.file == EntityFile::id) \ | ||
| object(CppAstNode = DependencyAstNode : CppTypeDependencyMetrics::dependencyHash == DependencyAstNode::entityHash \ | ||
| && DependencyAstNode::astType == cc::model::CppAstNode::AstType::Definition) \ | ||
| object(File = DependencyFile : DependencyAstNode::location.file == DependencyFile::id) | ||
| struct CppTypeDependencyMetricsPathView | ||
| { | ||
| #pragma db column(CppTypeDependencyMetrics::entityHash) | ||
| std::size_t entityHash; | ||
|
|
||
| #pragma db column(CppTypeDependencyMetrics::dependencyHash) | ||
| std::size_t dependencyHash; | ||
|
|
||
| #pragma db column(EntityFile::path) | ||
| std::string entityPath; | ||
|
|
||
| #pragma db column(DependencyFile::path) | ||
| std::string dependencyPath; | ||
| }; | ||
|
|
||
| #pragma db view \ | ||
| object(CppTypeDependencyMetrics) \ | ||
| object(CppAstNode = EntityAstNode : CppTypeDependencyMetrics::entityHash == EntityAstNode::entityHash \ | ||
| && EntityAstNode::astType == cc::model::CppAstNode::AstType::Definition) \ | ||
| object(File = EntityFile : EntityAstNode::location.file == EntityFile::id) \ | ||
| object(CppAstNode = DependencyAstNode : CppTypeDependencyMetrics::dependencyHash == DependencyAstNode::entityHash \ | ||
| && DependencyAstNode::astType == cc::model::CppAstNode::AstType::Definition) \ | ||
| object(File = DependencyFile : DependencyAstNode::location.file == DependencyFile::id) | ||
| struct CppTypeDependencyMetricsPathViewDistinctCount | ||
| { | ||
| #pragma db column("count(distinct" + CppTypeDependencyMetrics::dependencyHash + ")") | ||
| std::size_t count; | ||
| }; | ||
|
|
||
| } // model | ||
| } // cc | ||
|
|
||
| #endif // CC_MODEL_CPPTYPEDEPENDENCYMETRICS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_A1 | ||
| #define CC_CPP_MODULE_METRICS_TEST_A1 | ||
|
|
||
| #include "./a2.h" | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class A1 { | ||
| A2 a2; | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_A2 | ||
| #define CC_CPP_MODULE_METRICS_TEST_A2 | ||
|
|
||
| #include "../module_b/b1.h" | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class A2 { | ||
| B1 b1; | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_B1 | ||
| #define CC_CPP_MODULE_METRICS_TEST_B1 | ||
|
|
||
| #include "./b2.h" | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class B1 { | ||
| B2 b2; | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_B2 | ||
| #define CC_CPP_MODULE_METRICS_TEST_B2 | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class B2 {}; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_C1 | ||
| #define CC_CPP_MODULE_METRICS_TEST_C1 | ||
|
|
||
| #include "../module_b/b1.h" | ||
| #include "./c2.h" | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class C1 { | ||
| B1 b1; | ||
| C2 c2; | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #ifndef CC_CPP_MODULE_METRICS_TEST_C2 | ||
| #define CC_CPP_MODULE_METRICS_TEST_C2 | ||
|
|
||
| #include "../module_a/a2.h" | ||
| #include "../module_b/b1.h" | ||
|
|
||
| namespace CC_CPP_MODULE_METRICS_TEST | ||
| { | ||
| class C2 { | ||
| A2 a2; | ||
| B1 b1; | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #include "./module_a/a1.h" | ||
| #include "./module_a/a2.h" | ||
| #include "./module_b/b1.h" | ||
| #include "./module_b/b2.h" | ||
| #include "./module_c/c1.h" | ||
| #include "./module_c/c2.h" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.