| single |
|Web Site| Lizard
=================
|
Lizard is an extensible Cyclomatic Complexity Analyzer for many programming
languages
including C/C++ (doesn't require all the header files or Java imports). It
also does
copy-paste detection (code clone detection/code duplicate detection) and
many other forms of static
code analysis.
A list of supported languages:
- C# (C Sharp)
- C/C++ (works with C++14)
- COBOL
- Dart
- Erlang
- F# (see `F# analysis `_)
- Fortran
- GDScript
- Golang
- Java
- JavaScript (With ES6 and JSX)
- Kotlin
- Lua
- Objective-C
- OCaml (see [OCaml analysis])
- Perl
- PHP
- PL/SQL
- Python
- R
- Ruby
- Rust
- Scala
- Solidity
- Structured Text (St)
- Swift
- TTCN-3
- TypeScript (With TSX)
- VueJS
- Zig
By default lizard will search for any source code that it knows and mix
all the results together. This might not be what you want. You can use
the "-l" option to select language(s).
It counts
- the nloc (lines of code without comments),
- CCN (cyclomatic complexity number),
- token count of functions,
- parameter count of functions.
You can set limits for CCN (-C) and the number of parameters (-a).
Functions that exceed these limits will generate warnings. The exit
code of lizard will be non-zero if there are warnings.
This tool actually calculates how complex the code 'looks' rather than
how complex the code really 'is'. People will need this tool because it's
often very hard to get all the included folders and files right when
they are complicated. But we don't really need that kind of accuracy for
cyclomatic complexity.
It requires Python 3.8 or above. The test suite runs on Python 3.8, 3.9,
3.10,
3.11, 3.12, 3.13 and 3.14, on Linux and Windows, in continuous integration;
other versions are not verified.
JavaScript and TypeScript parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Named and anonymous arrows report the same formal parameter counts and
binding
names. Empty object and array patterns each occupy a parameter slot without
adding a name to the API's parameters list; ``({}, [], tail) => tail has
parameter_count 3 and parameters ['tail']``. Trailing commas and
TypeScript receiver declarations add no slots. Callback types add no
functions.
Each default parameter or destructuring initializer adds 1 to CCN, because
the initializer runs only when the supplied value is undefined. For
example,
``function f(a = 1, b = a + 1) { return a + b; }`` has CCN 3: the base
complexity of 1 plus two defaults. Defaults in object and array
destructuring
also count, including nested defaults and destructuring inside a function
body.
Explicit decisions within an initializer, such as a ternary expression or
``&&`` / ``||``, contribute separately.
This also applies to JSX and TSX. Defaults may increase CCN above a
configured
threshold. See [arrow boundaries] for
ternary branches, type annotations and the existing curried-arrow
convention.
|