-
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
Added calculation for relational cohesion metric #747
Open
kmkristof
wants to merge
20
commits into
Ericsson:master
Choose a base branch
from
kmkristof:RelationalCohesion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7681d4e
Build CodeCompass in Release mode in CI
mcserep 3c853e3
Log the start of each C++ metric computation
mcserep 7536c0a
Print debug info upon successful completion of TU parsing
mcserep 613ee04
Update Tarball generation for Ubuntu 20.04 Focal Fossa.
mcserep 0299025
Added calculation for relational cohesion
kmkristof 313d540
Fixed an include error
kmkristof de60077
Merge pull request #743 from mcserep/ci-release-build
intjftw 582981f
Merge pull request #744 from mcserep/metric-log
intjftw 48131f4
Merge pull request #745 from mcserep/cpp-parser-debug-success
intjftw 5f49828
Merge pull request #746 from Ericsson/tarball-ubuntu-focal
intjftw 7ba19f9
Incremental parsing issue fixes (#736)
dbukki 61a1f5f
Refactored relational cohesion calculation
kmkristof bb94b8a
Added calculation for relational cohesion
kmkristof 310da0b
Fixed an include error
kmkristof 5b51959
Refactored relational cohesion calculation
kmkristof 55078ec
Merge branch 'RelationalCohesion' of https://github.com/kmkristof/Cod…
kmkristof 212e18d
Moved type calculation into its own method
kmkristof cfc9ad2
Fixed requested changes
kmkristof 4a18189
Added unit test data
kmkristof e8720ec
Removed unneded logging
kmkristof 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 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 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 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 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 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 |
---|---|---|
|
@@ -61,65 +61,16 @@ variables: | |
echo "GLIBC version: $GLIBC_VERSION" | ||
echo "GLIBCXX versions: $GLIBCXX_VERSIONS" | ||
|
||
tarball suse-15: | ||
tarball ubuntu-20.04: | ||
extends: .tarball | ||
image: opensuse/leap:15 | ||
image: ubuntu:20.04 | ||
cache: | ||
key: "leap" | ||
key: "focal" | ||
variables: | ||
GCC_VERSION: 9.3.0 | ||
ODB_VERSION: 2.5.0 | ||
before_script: | ||
- zypper refresh | ||
- zypper update -y | ||
# download tools | ||
- zypper install -y curl wget gzip bzip2 unzip ca-certificates | ||
# build tools for CodeCompass | ||
- zypper install -y -t pattern devel_basis | ||
- zypper install -y binutils gcc-c++ gmp-devel | ||
# build tools for OpenLDAP | ||
- zypper install -y groff | ||
# build tools for ccdb-tools | ||
- zypper install -y libffi-devel | ||
# show GLIBC verison | ||
- *show-glibc-version | ||
|
||
# Permanently disabled job | ||
# (Distribution package repository metadata not available anymore.) | ||
.tarball suse-42.1: | ||
extends: .tarball | ||
image: opensuse/archive:42.1 | ||
cache: | ||
key: "malachite" | ||
variables: | ||
GCC_VERSION: 5.5.0 | ||
ODB_VERSION: 2.4.0 | ||
before_script: | ||
- zypper refresh | ||
- zypper update -y | ||
# download tools | ||
- zypper install -y curl wget gzip bzip2 unzip ca-certificates | ||
# build tools for CodeCompass | ||
- zypper install -y -t pattern devel_basis | ||
- zypper install -y binutils gcc-c++ gmp-devel | ||
# build tools for OpenLDAP | ||
- zypper install -y groff | ||
# build tools for ccdb-tools | ||
- zypper install -y libffi-devel | ||
# disable SSL certificate check (distribution's cacert is outdated) | ||
- echo "check_certificate = off" >> /etc/wgetrc | ||
- echo insecure >> ~/.curlrc | ||
# show GLIBC verison | ||
- *show-glibc-version | ||
|
||
tarball ubuntu-16.04: | ||
extends: .tarball | ||
image: ubuntu:16.04 | ||
cache: | ||
key: "xenial" | ||
variables: | ||
GCC_VERSION: 5.5.0 | ||
ODB_VERSION: 2.4.0 | ||
# No interactive timezone dialog for tzdata | ||
DEBIAN_FRONTEND: noninteractive | ||
before_script: | ||
- apt-get update -yqq | ||
# download tools | ||
|
@@ -154,22 +105,8 @@ tarball ubuntu-16.04: | |
- scp -P22 build/codecompass.tar.gz [email protected]:/var/www/codecompass/$FILENAME | ||
- ssh -p22 [email protected] "mv -f /var/www/codecompass/$FILENAME /var/www/codecompass/live/wwwroot/tarball/$FILENAME" | ||
|
||
upload suse-15: | ||
extends: .upload | ||
variables: | ||
ARCH_SUFFIX: suse-15 | ||
needs: ["tarball suse-15"] | ||
|
||
# Permanently disabled job | ||
# (Distribution package repository metadata not available anymore.) | ||
.upload suse-42.1: | ||
extends: .upload | ||
variables: | ||
ARCH_SUFFIX: suse-42.1 | ||
needs: ["tarball suse-42.1"] | ||
|
||
upload ubuntu-16.04: | ||
upload ubuntu-20.04: | ||
extends: .upload | ||
variables: | ||
ARCH_SUFFIX: ubuntu-16.04 | ||
needs: ["tarball ubuntu-16.04"] | ||
ARCH_SUFFIX: ubuntu-20.04 | ||
needs: ["tarball ubuntu-20.04"] |
This file contains 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 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 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 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 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
116 changes: 116 additions & 0 deletions
116
plugins/cpp_metrics/model/include/model/cpprelationalcohesion.h
This file contains 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,116 @@ | ||
#ifndef CC_MODEL_CPPRELATIONALCOHESION_H | ||
#define CC_MODEL_CPPRELATIONALCOHESION_H | ||
|
||
#include <model/cppentity.h> | ||
#include <model/cpprecord.h> | ||
#include <model/cppastnode.h> | ||
#include <model/cppfunction.h> | ||
#include <model/cppvariable.h> | ||
|
||
namespace cc | ||
{ | ||
namespace model | ||
{ | ||
|
||
#pragma db view \ | ||
object(File) | ||
struct RelationalCohesionFileView | ||
{ | ||
#pragma db column(File::path) | ||
std::string filePath; | ||
|
||
#pragma db column(File::type) | ||
std::string fileType; | ||
|
||
#pragma db column(File::id) | ||
std::size_t fileId; | ||
|
||
}; | ||
|
||
#pragma db view \ | ||
object(CppRecord) \ | ||
object(CppAstNode : CppRecord::astNodeId == CppAstNode::id) \ | ||
object(File : CppAstNode::location.file) \ | ||
object(CppMemberType : CppMemberType::memberAstNode) | ||
struct RelationalCohesionRecordView | ||
{ | ||
#pragma db column(CppEntity::entityHash) | ||
std::size_t entityHash; | ||
|
||
#pragma db column(CppMemberType::typeHash) | ||
std::size_t typeHash; | ||
|
||
#pragma db column(CppEntity::qualifiedName) | ||
std::string qualifiedName; | ||
|
||
#pragma db column(CppEntity::astNodeId) | ||
CppAstNodeId astNodeId; | ||
|
||
#pragma db column(File::path) | ||
std::string filePath; | ||
}; | ||
|
||
#pragma db view \ | ||
object(CppFunction) \ | ||
object(CppAstNode : CppFunction::astNodeId == CppAstNode::id) \ | ||
object(File : CppAstNode::location.file) | ||
struct RelationalCohesionFunctionView | ||
{ | ||
#pragma db column(CppEntity::entityHash) | ||
std::size_t entityHash; | ||
|
||
#pragma db column(CppTypedEntity::typeHash) | ||
std::size_t typeHash; | ||
|
||
#pragma db column(File::path) | ||
std::string filePath; | ||
}; | ||
|
||
|
||
#pragma db view \ | ||
object(CppFunction) \ | ||
object(CppVariable = Parameters : CppFunction::parameters) \ | ||
object(CppAstNode : CppAstNode::id == CppFunction::astNodeId) \ | ||
object(File : CppAstNode::location.file) | ||
struct RelationalCohessionFunctionParameterView | ||
{ | ||
#pragma db column(Parameters::typeHash) | ||
std::size_t typeHash; | ||
|
||
#pragma db column(File::path) | ||
std::string filePath; | ||
}; | ||
|
||
|
||
#pragma db view \ | ||
object(CppFunction) \ | ||
object(CppVariable = Locals : CppFunction::locals) \ | ||
object(CppAstNode : CppAstNode::id == CppFunction::astNodeId) \ | ||
object(File : CppAstNode::location.file) | ||
struct RelationalCohessionFunctionLocalView | ||
{ | ||
#pragma db column(Locals::typeHash) | ||
std::size_t typeHash; | ||
|
||
#pragma db column(File::path) | ||
std::string filePath; | ||
}; | ||
|
||
#pragma db view \ | ||
object(CppVariable) \ | ||
object(CppAstNode : CppAstNode::id == CppEntity::astNodeId) \ | ||
object(File : CppAstNode::location.file) | ||
struct RelationalCohesionVariableView | ||
{ | ||
#pragma db column(CppVariable::typeHash) | ||
std::size_t typeHash; | ||
|
||
#pragma db column(File::path) | ||
std::string filePath; | ||
|
||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains 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
Oops, something went wrong.
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.
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 think the same view is used in #757. In this case a more generic name should be used and code duplication should be avoided.
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.
A common view could probably be used however the same applies to "CohesionCppRecordView" for example ("RelationalCohesionRecordView" contains this + typeHash).
Maybe this should be looked at separately to unify the commonly used views?
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.
You started working concurrently on a second issue before finishing this one. I don't advise to merge in duplicated code segments so close to each other in time, and then refactor them in a follow-up issue.