/qa-code-quality:lizard-complexityfrom qa-code-quality
Runs Lizard (30+ languages) to measure and enforce cyclomatic complexity, function length, and parameter-count thresholds as a CI gate, excluding tests.
Ships in qa-code-quality. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Lizard analyzes source code per function for NLOC (non-comment LoC), CCN (cyclomatic complexity), token count, and parameter count across 30+ languages including C/C++, Java, Python, JavaScript, Go, Rust, TypeScript, Swift, Kotlin (per the Lizard README). Default CCN warning threshold is 15.
pip install lizard
Or run the standalone script:
python lizard.py path/to/code
Per the Lizard README, no external deps required.
lizard src/
Default output groups by file with per-function NLOC/CCN/token/param counts. Default warning threshold: CCN ≥ 15.
lizard src/ \
-x"./tests/*" \
-x"./vendor/*" \
-C 10 \
-L 100 \
-a 5
| Flag | Meaning |
|---|---|
-x PATTERN | Exclude (must include tests/** for production-only scope) |
-C N | CCN warning threshold (default 15; tighten to 10 for new codebases) |
-L N | Max function NLOC (default 1000; tighten to 80 - 100) |
-a N | Max parameter count (5 = "if you need more, pass an object") |
# CSV for grep / jq pipelines
lizard src/ -x"./tests/*" -C 10 --csv > lizard.csv
# XML for CI parsers (cppncss-style)
lizard src/ -x"./tests/*" -C 10 -X > lizard.xml
# HTML for human review
lizard src/ -x"./tests/*" -C 10 -H > lizard.html
lizard src/ -x"./tests/*" -C 10 -L 100 -a 5 -w
EXIT=$?
if [ "$EXIT" -ne 0 ]; then
echo "Complexity threshold breached. See report."
exit 1
fi
-w prints warnings only (clang/gcc style). Lizard exits non-zero
when any function exceeds the configured threshold.
# Only Python
lizard src/ -l python -C 10
# Only TypeScript + JS
lizard src/ -l typescript -l javascript -C 10
Useful when a polyglot repo has language-specific budgets (e.g., Python tolerates higher CCN than C).
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Run on whole repo including tests | Test setup helpers ("create user with 12 fields") look complex; tests get refactored away from clarity | Always exclude tests/, spec/ (Step 3) |
| Set CCN threshold to default (15) | Too lax for new code | Start at 10 for new code; track existing code as baseline |
| Block PRs on absolute count | Legacy code can't add a single line | Diff-only: scan PR-changed functions only with git diff --name-only filter |
| Refactor for CCN at expense of clarity | Splitting a clear linear function into 4 helpers raises overall complexity | Use CCN as a smell signal, not a hard rule |
| Skip parameter-count guard | "God functions" with 12 args slip through | -a 5 enforces object-arg style |
sonarqube-maintainability-gate for cognitive
complexity if needed.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub testland/qa --plugin qa-code-quality4 skills in this plugin
/knip-dead-codeUse after a feature or route is deleted and the project still compiles, or when package.json has dependencies nobody can explain. Runs Knip on a JS/TS project to find unused files, dependencies, exports and class or enum members, aware of test entry points through its framework plugins./madge-depsUse for any question or task about circular imports or dependency cycles in JavaScript or TypeScript, including an import that is undefined at runtime even though the build compiles and CI that should block new cycles: runs Madge on production code to find circular dependencies and orphan modules and draw the module graph, excluding test files./sonarqube-maintainability-gateUse when a team wants maintainability and technical-debt ratings to gate PRs, or a SonarQube project reports numbers nobody tied to a gate. Runs SonarQube or SonarCloud on production code for code smells, bugs and maintainability ratings, the maintainability view rather than security.2 plugins ship this exact skill · first indexed Nov 12, 2026
Other plugins' skills for the same job