Closed etorlows closed 7 years ago
First, as the readme states, Lizard does not handle macros (code-gen) by its design. It tries to ignore them. Macros are evil; the code may end-up looking syntactically bogus for tools that don't do macro processing.
I don't see what the problem is when running from the command-line:
================================================
NLOC CCN token PARAM length location
------------------------------------------------
9 2 26 0 9 myFunction@1-9@code.cc
4 1 8 0 4 mySecondFunction@11-14@code.cc
1 file analyzed.
==============================================================
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
--------------------------------------------------------------
13 6.5 1.5 17.0 2 code.cc
=============================================================================================
No thresholds exceeded (cyclomatic_complexity > 15 or length > 1000 or parameter_count > 100)
==========================================================================================
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
------------------------------------------------------------------------------------------
13 6.5 1.5 17.0 2 0 0.00 0.00
The reason I created Lizard was because I wanted to ignore preprocessing when getting the complexity numbers. The downside is for some macros that breaks the syntax without expanding them lizard might not work.
I'm looking for a solution now but it'll take time:-)
This is fixed now. Lizard and recognise both method, with the right measurement.
@terryyin Please reference your commits with issue numbers.
Transferring the discussion to appropriate thread from https://github.com/terryyin/lizard/issues/126#issuecomment-323616183
@rakhimov I removed two lines of nested_structure code to pass a test. Do you remember why they were there? e4c6898
git blame
helps track down the reason:
commit fd44240fa4f4e7eccc36eb4a2dd76687479e5010
Author: rakhimov <...>
Date: Fri Dec 30 13:24:05 2016 -0800
Implement proper NS for paired structures
Paired structures: try-catch, catch-catch, if-else, do-while.
These structures keep the level from being decremented
if they are declared right after each other.
Fixes #157.
I need to look deeper to the recent changes and add more NS tests.
With the following C++ code:
Dox generates the following output:
I've found that when the IGNORE_FLAGS and END_IGNORE_FLAGS macros are removed, the tool works without issue.