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

Bumpy road complexity metrics #714

Merged
merged 35 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0debec5
Preliminary refactor of relevant parser code.
dbukki Feb 22, 2024
b155518
First draft of computing bumpiness of functions via a statement scope…
dbukki Feb 24, 2024
0d10be7
Bumpy road metrics extraction from parsed functions.
dbukki Feb 24, 2024
03a60ef
First set of unit tests.
dbukki Feb 24, 2024
d44728a
Decorator functions replaced by scope objects on stack.
dbukki Feb 25, 2024
0877185
TraverseDecl and TraverseStmt have been refactored.
dbukki Feb 25, 2024
a8181ba
ScopedValue is moved to util with some extra C++ generalizations.
dbukki Feb 25, 2024
0d30293
McCabe test case modifications.
dbukki Feb 28, 2024
9bb9b62
McCabe test fix: function declarations without a definition should no…
dbukki Feb 28, 2024
4d2104e
McCabe test fix again: Without signatures in the qualified function n…
dbukki Feb 28, 2024
c78193a
Added nested transparent blocks to handle case and default labels exp…
dbukki Feb 28, 2024
80a0f42
Elimination of inheritence, virtual functions and dyn_cast-s to boost…
dbukki Feb 28, 2024
c538bd1
Minor adjustments and code polishing.
dbukki Feb 29, 2024
7ebf7c6
Revoke local changes from gitignore (mistake).
dbukki Feb 29, 2024
e0d1450
Revoke local changes from gitignore (mistake).
dbukki Feb 29, 2024
e2661e9
Merge branch 'bumpy-road' of https://github.com/dbukki/CodeCompass in…
dbukki Feb 29, 2024
68daa6a
Preliminary refactor of relevant parser code.
dbukki Feb 22, 2024
a7143e9
First draft of computing bumpiness of functions via a statement scope…
dbukki Feb 24, 2024
ba32b6c
Bumpy road metrics extraction from parsed functions.
dbukki Feb 24, 2024
0f81ae0
First set of unit tests.
dbukki Feb 24, 2024
8b77d47
Decorator functions replaced by scope objects on stack.
dbukki Feb 25, 2024
14b8273
TraverseDecl and TraverseStmt have been refactored.
dbukki Feb 25, 2024
605b49d
ScopedValue is moved to util with some extra C++ generalizations.
dbukki Feb 25, 2024
a1904e7
McCabe test case modifications.
dbukki Feb 28, 2024
0cd0796
McCabe test fix: function declarations without a definition should no…
dbukki Feb 28, 2024
a352eee
McCabe test fix again: Without signatures in the qualified function n…
dbukki Feb 28, 2024
16957d9
Added nested transparent blocks to handle case and default labels exp…
dbukki Feb 28, 2024
3ac576f
Elimination of inheritence, virtual functions and dyn_cast-s to boost…
dbukki Feb 28, 2024
1bbc9c4
Minor adjustments and code polishing.
dbukki Feb 29, 2024
e51dff2
Revoke local changes from gitignore (mistake).
dbukki Feb 29, 2024
c8f9788
Revoke local changes from gitignore (mistake).
dbukki Feb 29, 2024
f90aade
Elimination of some recently introduced compiler warnings.
dbukki Feb 29, 2024
244372b
Merge branch 'bumpy-road' of https://github.com/dbukki/CodeCompass in…
dbukki Feb 29, 2024
f9bddaa
New line adjustments in diff.
dbukki Feb 29, 2024
e77d2cd
Copy and move semantics have been disabled for scope types.
dbukki Mar 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions plugins/cpp/model/include/model/cppfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ struct CppFunction : CppTypedEntity
std::vector<odb::lazy_shared_ptr<CppVariable>> parameters;
#pragma db on_delete(cascade)
std::vector<odb::lazy_shared_ptr<CppVariable>> locals;

unsigned int mccabe;
unsigned int bumpiness;
unsigned int statementCount;

std::string toString() const
{
Expand Down Expand Up @@ -82,6 +85,25 @@ struct CppFunctionMcCabe
std::string filePath;
};

#pragma db view \
object(CppFunction) \
object(CppAstNode : CppFunction::astNodeId == CppAstNode::id) \
object(File : CppAstNode::location.file)
struct CppFunctionBumpyRoad
{
#pragma db column(CppEntity::astNodeId)
CppAstNodeId astNodeId;

#pragma db column(CppFunction::bumpiness)
unsigned int bumpiness;

#pragma db column(CppFunction::statementCount)
unsigned int statementCount;

#pragma db column(File::path)
std::string filePath;
};

}
}

Expand Down
3 changes: 2 additions & 1 deletion plugins/cpp/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ add_library(cppparser SHARED
src/ppmacrocallback.cpp
src/relationcollector.cpp
src/doccommentformatter.cpp
src/diagnosticmessagehandler.cpp)
src/diagnosticmessagehandler.cpp
src/nestedscope.cpp)

target_link_libraries(cppparser
cppmodel
Expand Down
Loading
Loading