lizard-wrapperdeprecated

A Node.js wrapper for Lizard, a code complexity analyser.

Usage no npm install needed!

<script type="module">
  import lizardWrapper from 'https://cdn.skypack.dev/lizard-wrapper';
</script>

README

Lizard wrapper

A Node.js wrapper for Lizard, a code complexity analyser.

Requirements

pip install lizard

Installation

npm install lizard-wrapper

Usage

Sample code

const lizard = require('lizard-wrapper');

var result = lizard.analyzeFile('fizzbuzz.cpp');
var s = JSON.stringify(result);
console.log(s);

You can also use source code string instead of file.

var result = lizard.analyzeSourceCode('foo.cpp', 'int foo(){}');

Sample output

{"filename":"fizzbuzz.cpp","nloc":15,"function_list":[{"cyclomatic_complexity":6,"nloc":13,"token_co
unt":89,"name":"main","long_name":"main()","start_line":3,"end_line":15,"parameters":[],"filename":"
fizzbuzz.cpp","top_nesting_level":0,"length":13,"fan_in":0,"fan_out":0,"general_fan_out":0}],"token_
count":96}

Licence

MIT License