Integrations¶
polyscan is a single binary that reads files and writes results, so it fits anywhere you can run a command.
Editor integration¶
There is no editor extension yet. The closest thing available today is a task or watch script that runs polyscan on save. It is not fast enough to run on every keystroke, since a full analysis of a large project takes seconds rather than milliseconds, but a fast subset works well on save:
{
"version": "2.0.0",
"tasks": [
{
"label": "polyscan: complexity",
"type": "shell",
"command": "polyscan analyze --select complexity --format text src/",
"problemMatcher": []
}
]
}
Using polyscan from a script¶
--format json gives machine-readable output on standard output, with the human-readable summary on standard error.
#!/usr/bin/env bash
set -euo pipefail
score=$(polyscan analyze --format json src/ 2>/dev/null | jq '.summary.health_score')
echo "Health score: $score"
if [ "$score" -lt 75 ]; then
echo "Score is below the grade B threshold" >&2
exit 1
fi
Note the 2>/dev/null. polyscan analyze --format json writes its score summary to standard error, so discarding standard error keeps the parsed output clean. See output formats.
Pinning the version¶
The JSON output shape is not covered by a stability guarantee yet. Anything that parses it should pin a version rather than track the latest release:
In a pipeline that uses npx, name the version explicitly: