forked from Ericsson/CodeCompass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcppmetricsparser.h
More file actions
66 lines (54 loc) · 1.81 KB
/
cppmetricsparser.h
File metadata and controls
66 lines (54 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef CC_PARSER_CPPMETRICSPARSER_H
#define CC_PARSER_CPPMETRICSPARSER_H
#include <parser/abstractparser.h>
#include <parser/parsercontext.h>
#include <model/cppastnodemetrics.h>
#include <model/cppastnodemetrics-odb.hxx>
#include <model/cppfunction.h>
#include <model/cppfunction-odb.hxx>
#include <model/cpprecord.h>
#include <model/cpprecord-odb.hxx>
#include <util/parserutil.h>
#include <util/threadpool.h>
namespace cc
{
namespace parser
{
class CppMetricsParser : public AbstractParser
{
public:
CppMetricsParser(ParserContext& ctx_);
virtual ~CppMetricsParser();
virtual bool cleanupDatabase() override;
virtual bool parse() override;
private:
// Calculate the count of parameters for every function.
void functionParameters();
// Calculate the McCabe complexity of functions.
void functionMcCabe();
// Calculate the bumpy road metric for every function.
void functionBumpyRoad();
// Calculate the lack of cohesion between member variables
// and member functions for every type.
void lackOfCohesion();
// Calculate the cohesion within modules
void relationalCohesion();
// Check type relations in template parameter view.
// Used in relational cohesion metric.
template <typename T>
void checkTypes(
const std::string& path,
const std::unordered_set<std::uint64_t>& typesFound,
const std::unordered_map<std::uint64_t,std::string>& typeDefinitionPaths,
std::unordered_multimap<std::string, std::uint64_t>& relationsFoundInFile,
int& relationsInModule
);
std::vector<std::string> _inputPaths;
std::string _modulesPath;
std::unordered_set<model::FileId> _fileIdCache;
std::unordered_map<model::CppAstNodeId, model::FileId> _astNodeIdCache;
std::unique_ptr<util::JobQueueThreadPool<std::string>> _pool;
};
} // parser
} // cc
#endif // CC_PARSER_CPPMETRICSPARSER_H