Tested tool guide
Tested browser tools
Checked August 16, 2026
What Code Complexity Analyzer does, with a checked example
This tool parses a JavaScript or TypeScript snippet or file and reports, per function, its cyclomatic complexity, lines of code, and a maintainability index, so you can see which functions are hardest to test or safest to leave alone before a refactor. Cyclomatic complexity follows the standard model: a baseline of 1 for the function, plus 1 for each additional branch point the parser identifies, such as if and else if conditions and loop conditions, though whether less-common constructs such as case labels, catch blocks, ternaries, and short-circuit && / || operators also count as branch points can vary between analyzers, so treat the number as a relative signal rather than a hand-checkable formula. A function built from many independent sequential checks and a function with the same number of deeply nested checks can land on the same complexity score, since the count tracks total branch points rather than nesting depth.
Worked example
A concrete input and expected output from the current implementation.
Input
function classify(n) {
if (n < 0) {
return "negative";
} else if (n === 0) {
return "zero";
} else {
return "positive";
}
} ->
Expected output
classify: cyclomatic complexity 3, lines of code 9
The function has two decision points, the if (n < 0) test and the else if (n === 0) test, each adding 1 to the baseline of 1, giving CC = 3; the plain else adds no path of its own. All 9 physical lines, including the braces, fall inside the function body, giving LOC = 9.