You can set limitation for CCN (-C), the number of parameters (-a). Functionsthat exceed these limitations will generate warnings. The exit code of lizardwill be none-Zero if there are warnings.

This tool actually calculates how complex the code 'looks' rather than howcomplex the code real 'is'. People will need this tool because it's often veryhard to get all the included folders and files right when they are complicated.But we don't really need that kind of accuracy when come to cyclomaticcomplexity.

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

##Installation

lizard.py is only a single python file, and everything is in that single script. You can always use it without any installation.

<pre>python lizard.py</pre>

If you want a proper install:

<pre>[sudo] pip install lizard</pre>

Or if you've got the source:

<pre>[sudo] python setup.py install</pre>

##Usage

<pre>lizard [options] [PATH or FILE] [PATH] ... </pre>Run for the code under current folder (recursively):<pre>lizard</pre>Exclude anything in the tests folder:

lizard mySource/ -x"./tests/``*``"

### Options

--version show program's version number and exit -h, --help show this help message and exit -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 this number 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, otherwize it will generate error. Useful in makefile when improving legacy code. -x EXCLUDE, --exclude=EXCLUDE Exclude files that match this pattern. ``*`` matches everything, ? matches any single characoter, "./folder/``*``" exclude everything in the folder, recursively. Multiple patterns can be specified. Don't forget to add "" around the pattern. -X, --xml Generate XML in cppncss style instead of the normal tabular output. Useful to generate report in Jenkins server -P, --no_preprocessor_count By default, a #if will also increase the complexity. Adding this option to ignore them -t WORKING_THREADS, --working_threads=WORKING_THREADS number of working threads. The default value is 1. -d, --find_duplicates Find and skip analysis for file duplicates.

You can also use source code string instead of file. But you need to provide a file name (to identify the language).python>>> i = lizard.analyze_file.analyze_source_code("AllTests.cpp", "int foo(){}")

## WhitelistIf for some reason you would like to ignore the warnings, you can use the whitelist. Add 'whitelizard.txt' to the current folder, then the functions defined in the file will be ignored. This is an example

<pre>#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.filename:function1, function2 # you can also specify the filename</pre>