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

cannot get CCN in such situation #194

Open qwertmy opened 7 years ago

qwertmy commented 7 years ago

xxx.c void func_a() { xxx; xxx;

if 0

       if (a==b       /****error compile****/
       {
             cccccc;
       }
  #endif
  xxx;

}

NLOC CCN token PARAM length location

1 file analyzed.

NLOC Avg.NLOC AvgCCN Avg.token function_cnt file

 23       0.0     0.0        0.0         0     1.c

when the error compile recovered

NLOC CCN token PARAM length location

  23      9    114      1      30 XXX@8-37@1.c

1 file analyzed.

NLOC Avg.NLOC AvgCCN Avg.token function_cnt file

 23      23.0     9.0      114.0         1     1.c
terryyin commented 7 years ago

Yes, lizard cannot accurately process preprocessor. That's a trade off so that it doesn't need all the header files.

I'm considering implementing to support at least preprocessing within the file...

terryyin commented 7 years ago

After some consideration, I decided that putting code block in "#if 0" is a bad practice. We should rely on our version control system for such a need. So I will still delay the implementation of real preprocessing support.