nocuous

CI npm version

A static code analysis tool for JavaScript and TypeScript.

Background

The statistics collected around code toxicity are based directly on Erik Dörnenburg's article How toxic is your code?.

The default metrics are based on what is suggested in the article. When applying to TypeScript/JavaScript there are some adaptation that is required:

Metric Table Label Description Default Threshold
File length L The number of lines in a file. 500
Class data abstraction coupling CDAC The number of instances of other classes that are "new"ed in a given class. 10
Anon Inner Length AIL Class expressions of arrow functions length in number of lines. 35
Function Length FL The number of statements in a function declaration, function expression, or method declaration. 30
Parameter Number P The number of parameters for a function or method 6
Cyclomatic Complexity CC The cyclomatic complexity for a function or method 10
Binary Expression Complexity BEC How complex a binary expression is (e.g. how many && and `
Missing Switch Default MSD Any switch statements that are missing the default case. 1