Skip to content

complexijs

A native Rust CLI that computes the cognitive complexity of JavaScript and TypeScript files.

complexijs is a port of complexipy with the Python analyzer replaced by a JS/TS analyzer (swc) and the Python CLI replaced by a pure-Rust clap CLI.

Install

cargo install --path .

The binary is named complexijs.

Quick start

Analyze the current directory:

complexijs .

Analyze specific paths:

complexijs src lib/util.ts

A function fails when its complexity is strictly greater than the maximum allowed (default 15).

See Usage for the full flag reference, and Complexity model for how scores are computed.

Acknowledgments

complexijs is a port of complexipy, the original project this one follows. Thank you to its author, Robin Quintero (@rohaquinlop), for the design of the tool and for the cognitive complexity implementation that complexijs mirrors: the CLI shape, the configuration model, the snapshot watermark idea, and the scoring rules all come from that work.

If you write Python, use complexipy: https://github.com/rohaquinlop/complexipy