JavaScript · TypeScript · Go · Rust · C++
Find what to fix first¶
polyscan reads your source, scores the codebase from 0 to 100, and produces an HTML report that ranks the problems worth your attention. One command covers every supported language in one report: it runs with no build step, no type checker, and no project configuration.
91/100 Grade A
What polyscan measures¶
polyscan looks at your code from five angles. Each one contributes a category score, and the analyzed categories combine into a single health score. Complexity and duplicate code cover every supported language; dead code, dependencies and class design run for JavaScript and TypeScript, and a dimension a language does not have is left out of the score rather than counted as clean. The health score page explains exactly how the arithmetic works.
-
Complexity
Cyclomatic complexity per function, which counts the number of independent paths through the code, in every supported language. High values mark the functions that are hardest to read and to test.
-
Duplicate code
Copy-pasted and structurally similar code, in every supported language. polyscan compares syntax trees rather than text, so it still matches fragments after variables have been renamed or statements reordered.
-
Dead code JS/TS
Statements that can never execute, exported functions that nothing imports, and imports that nothing uses. polyscan finds these by building a control flow graph for every function and walking it from the entry point.
-
Dependencies JS/TS
The module import graph, including circular imports and the Martin coupling metrics, derived from resolving every import across the analyzed files.
-
Class design JS/TS
Coupling between objects, which counts how many other types each class or module depends on. Classes near the top of this list are the ones that break when anything else changes.
-
Machine-readable output
The same results as one JSON document per run, with the language on every function and clone fragment, for dashboards, bots, and CI gates built on
jq.
Three commands worth knowing¶
# Full analysis with an HTML report that opens in your browser
polyscan analyze .
# Full findings in the terminal, ending with the health score
polyscan analyze --format text src/
# JSON to stdout, for scripts and CI gates
polyscan analyze --format json src/ > report.json
Working with Python instead?¶
The same analyses are available for Python in pyscn, which shares its core algorithms with polyscan. And if you are arriving from jscan, the JavaScript/TypeScript analyzer that merged into polyscan, the migration page maps every old command to its replacement.