terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

CPP, problem introduced in lizard #52

Closed norkos closed 9 years ago

norkos commented 9 years ago

Hi,

I am using my forked version of you repo (https://github.com/norkos/lizard.git) which is quite old one. While changing to new version I have met problem in files like:

include

class Timer{

ifndef TEST

Timer(int j);

else

Timer();

endif

};

ifndef TEST

Timer::Timer(int j) {

else

Timer::Timer() {

endif

for (int i = 0; i < 10; i++)
{
}

ifndef TEST

std::cout << "Branch";

endif

}

int main(){ return 0; }

No function is find in this file.

NLOC Avg.NLOC AvgCCN Avg.ttoken function_cnt file

 17      0    0.0         0         0     check.cpp

Previously I had:

nloc CCN token param function@line@file

10      3     32      1    Timer::Timer@13@check.cpp
 1      1      3      0    main@29@check.cpp

Could you please help me ? Thank you in advance.

btw. I am aware that this code is tricky ...

terryyin commented 9 years ago

Yes. This is because lizard previously would choose only one branch to parse if there is a #if. I've removed that feature, I believe should be because it created some trouble and keep things simple.

In the above code, if the left brace { can be left out of the #if block, the result will look better.

Do you think I should introduce the feature back?

norkos commented 9 years ago

Hi Terry, thank you a lot for your quick response. Unfortuntaly I am using Lizard for the code that I cannot change therefore I cannot move "{".

I would really appriciate if you could introduce the feature back. Otherwise I would need to stay with elder version. I have seen lots of great work in Lizard and it would a pity for me.

If you want I can make some tests of the branch.

Thank you in advance.

terryyin commented 9 years ago

Let me look at it.

terryyin commented 9 years ago

It will take a bit more time.

terryyin commented 9 years ago

OK. Now you can have that functionality back by using an extension:

lizard -Ecpre