Skip to content

Commit 5bfc159

Browse files
mcserepdbukki
andauthored
Bumpy road complexity metrics (#738)
Co-authored-by: Bükki Dániel <[email protected]>
1 parent 194afa2 commit 5bfc159

File tree

16 files changed

+1387
-375
lines changed

16 files changed

+1387
-375
lines changed

plugins/cpp/model/include/model/cppfunction.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ struct CppFunction : CppTypedEntity
1818
std::vector<odb::lazy_shared_ptr<CppVariable>> parameters;
1919
#pragma db on_delete(cascade)
2020
std::vector<odb::lazy_shared_ptr<CppVariable>> locals;
21+
2122
unsigned int mccabe;
23+
unsigned int bumpiness;
24+
unsigned int statementCount;
2225

2326
std::string toString() const
2427
{
@@ -82,6 +85,25 @@ struct CppFunctionMcCabe
8285
std::string filePath;
8386
};
8487

88+
#pragma db view \
89+
object(CppFunction) \
90+
object(CppAstNode : CppFunction::astNodeId == CppAstNode::id) \
91+
object(File : CppAstNode::location.file)
92+
struct CppFunctionBumpyRoad
93+
{
94+
#pragma db column(CppEntity::astNodeId)
95+
CppAstNodeId astNodeId;
96+
97+
#pragma db column(CppFunction::bumpiness)
98+
unsigned int bumpiness;
99+
100+
#pragma db column(CppFunction::statementCount)
101+
unsigned int statementCount;
102+
103+
#pragma db column(File::path)
104+
std::string filePath;
105+
};
106+
85107
}
86108
}
87109

plugins/cpp/parser/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ add_library(cppparser SHARED
4444
src/ppmacrocallback.cpp
4545
src/relationcollector.cpp
4646
src/doccommentformatter.cpp
47-
src/diagnosticmessagehandler.cpp)
47+
src/diagnosticmessagehandler.cpp
48+
src/nestedscope.cpp)
4849

4950
target_link_libraries(cppparser
5051
cppmodel

0 commit comments

Comments
 (0)