You can set limitation for CCN (-C), the number of parameters (-a).Functions that exceed these limitations will generate warnings. The exitcode of lizard will be none-Zero if there are warnings.

This tool actually calculates how complex the code 'looks' rather thanhow complex the code really 'is'. People will need this tool because it'soften very hard to get all the included folders and files right whenthey are complicated. But we don't really need that kind of accuracy forcyclomatic complexity.

It requires python2.7 or above (early versions are not verified).

Installation------------

lizard.py can be used as a stand alone Python script, mostfunctionalities are there. You can always use it without anyinstallation. To acquire all the functionalities of lizard, you willneed a proper install.

-h, --help show this help message and exit --version show program's version number and exit -l LANGUAGES, --languages LANGUAGES List the programming languages you want to analyze. if left empty, it'll search for all languages it knows. lizard -l cpp -l java searches for C++ and Java code. The available languages are: cpp, java, javascript, python, objectivec, ttcn -V, --verbose Output in verbose mode (long function name) -C CCN, --CCN CCN Threshold for cyclomatic complexity number warning. The default value is 15. Functions with CCN bigger than it will generate warning -L LENGTH, --length LENGTH Threshold for maximum function length warning. The default value is 1000. Functions length bigger than it will generate warning -a ARGUMENTS, --arguments ARGUMENTS Limit for number of parameters -w, --warnings_only Show warnings only, using clang/gcc's warning format for printing warnings. http://clang.llvm.org/docs/UsersManual.html#cmdoption- fdiagnostics-format -i NUMBER, --ignore_warnings NUMBER If the number of warnings is equal or less than the number, the tool will exit normally, otherwise it will generate error. Useful in makefile for legacy code. -x EXCLUDE, --exclude EXCLUDE Exclude files that match this pattern. * matches everything, ? matches any single character, "./folder/*" exclude everything in the folder recursively. Multiple patterns can be specified. Don't forget to add "" around the pattern. --csv Generate CSV output as a transform of the default output -X, --xml Generate XML in cppncss style instead of the tabular output. Useful to generate report in Jenkins server -t WORKING_THREADS, --working_threads WORKING_THREADS number of working threads. The default value is 1. Using a bigger number can fully utilize the CPU and often faster. -m, --modified Calculate modified cyclomatic complexity number, which count a switch/case with multiple cases as one CCN. -E EXTENSIONS, --extension EXTENSIONS User the extensions. The available extensions are: -Ecpre: it will ignore code in the #else branch. -Ewordcount: count word frequencies and generate tag cloud. -Eoutside: include the global code as one function. -s SORTING, --sort SORTING Sort the warning with field. The field can be nloc, cyclomatic_complexity, token_count, parameter_count, etc. Or an customized file. -W WHITELIST, --whitelist WHITELIST The path and file name to the whitelist file. It's './whitelizard.txt' by default.

If for some reason you would like to ignore the warnings, you can usethe whitelist. Add 'whitelizard.txt' to the current folder (or use -W to point to the whitelist file), then thefunctions defined in the file will be ignored. Please notice that if you assign the file pathname, it needs tobe exactly the same relative path as Lizard to find the file. An easy way to get the file pathname is to copy it fromthe Lizard warning output.This is an example whitelist:

::

#whitelizard.txt #The file name can only be whitelizard.txt and put it in the current folder. #You may have commented lines begin with #. function_name1, function_name2 # list function names in mulitple lines or split with comma. file/path/name:function1, function2 # you can also specify the filename

Options in Comments-------------------

You can use options in the comments of the source code to change thebehavior of lizard. By putting "#lizard forgives" inside a function orbefore a function it will suppress the warning for that function.

This approach makes the Lizard implementationsimpler and more focused with partial parsers for various languages.Developers of Lizard attempt to minimize the possibility of soft failures.Hard failures are bugs in Lizard code,while soft failures are trade-offs or potential bugs.

In addition to asserting the correct code,Lizard may choose not to deal with some advanced or complicated language features:

- C/C++ digraphs and trigraphs are not recognized.- C/C++ preprocessing or macro expansion is not performed. For example, using macro instead of parentheses (or partial statements in macros) can confuse Lizard's bracket stacks.- Some C++ complicated templates may cause confusion with matching angle brackets and processing less-than ``<`` or more-than ``>`` operators inside of template arguments.

Literatures Refering to Lizard-----------

Lizard is often used in software related researches. If you used it to support your work, you may contact the lizard author to add your work in the following list.

- Software Quality in the ATLAS experiment at CERN, which refers to Lizard as one of the tools, has been published in the Journal of Physics: http://iopscience.iop.org/article/10.1088/1742-6596/898/7/072011