mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-24 14:22:40 -06:00
.examples: Fixed CodeMetric
git-svn-id: svn://ultimatepp.org/upp/trunk@3124 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0840ca819e
commit
4fdf4bb530
1 changed files with 5 additions and 11 deletions
|
|
@ -37,14 +37,6 @@ String InsertNestingToSignature(String natural, String nesting)
|
|||
return natural;
|
||||
}
|
||||
|
||||
int BodyPos(const Vector<CppPos> &pos)
|
||||
{
|
||||
for(int i = 0; i < pos.GetCount(); i++)
|
||||
if(pos[i].impl)
|
||||
return pos[i].line;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CodeMetric::CodeMetric(const String &fileContent) :
|
||||
orphanLines(0), blankLines(0), commentLines(0)
|
||||
{
|
||||
|
|
@ -106,12 +98,14 @@ void CodeMetric::StoreMetric(const Parser::FunctionStat & functionStat)
|
|||
static Vector<int> cc2_symbols(
|
||||
Vector<int>() << t_and << t_or << '?');
|
||||
|
||||
|
||||
if(!functionStat.cppItem.impl)
|
||||
return;
|
||||
|
||||
FunctionEntry &entry = functions.Add();
|
||||
|
||||
entry.pos = BodyPos(functionStat.cppItem.pos);
|
||||
entry.pos = functionStat.cppItem.line;
|
||||
entry.name = InsertNestingToSignature(functionStat.cppItem.natural,
|
||||
functionStat.nesting);
|
||||
functionStat.scope);
|
||||
int cc1 = 1 + functionStat.symbolStat.SumStat( cc1_symbols );
|
||||
entry.cyclomaticComplexity1 = cc1;
|
||||
entry.cyclomaticComplexity2 = cc1 + functionStat.symbolStat.SumStat( cc2_symbols );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue