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.81k stars 246 forks source link

lizard --sort cyclomatic_complexity --CCN 10 shows a file with CCN score of 1 #356

Open huornlmj opened 2 years ago

huornlmj commented 2 years ago

Taking a well known and popular network port mapper's source code and scanning it with:

lizard --sort cyclomatic_complexity --CCN 10

The following is shown at the end of the report. I had expected there to only be files with cyclomatic complexity of above 10 shown, but as you can see there is a file included with a CCN of 1.

$ lizard --sort cyclomatic_complexity --CCN 10
--SNIP--
      34     11    222      2      48 ScanProgressMeter::printStatsIfNecessary@568-615@./timing.cc
      53     11    455      1      63 l_dnet_get_interface_info@49-111@./nse_dnet.cc
      46     11    295      3      56 test2str@492-547@./osscan.cc
      29     11    236      2      39 NetBlockIPv6Netmask::next@535-573@./TargetGroup.cc
      32     11    178      0      51 FingerPrintResults::OmitSubmissionFP@132-182@./FingerPrintResults.cc
      34     11    211      0      50 FingerPrintResults::populateClassification@207-256@./FingerPrintResults.cc
      21     11    164      0      30 parse_resolvdotconf@945-974@./nmap_dns.cc
      23     11    194      1      31 parse_etchosts@977-1007@./nmap_dns.cc
      48     11    288      3      57 mmapfile@595-651@./utils.cc
      27     11    112      2      27 against_name@297-323@./nse_main.lua
      33     11    203      0      34 Thread@518-551@./nse_main.lua
      43     11    275      1      43 lzstream_decompress@549-591@./nse_zlib.cc
      37     11    301     13      51 build_tcp@631-681@./tcpip.cc
      58     11    433      3      64 receive_buf@673-736@./nse_nsock.cc
    1348      1   7764      0    1348 load_fp_matches@2491-3838@./FPModel.cc
==========================================================================================
Total nloc   Avg.NLOC  AvgCCN  Avg.token   Fun Cnt  Warning cnt   Fun Rt   nloc Rt
------------------------------------------------------------------------------------------
    308332      18.8     5.1      124.8    12308         1186      0.10    0.46