@codacy/tools-lizard-1
v0.6.2
Published
Lizard adapter — CLI-mode code complexity analyzer
Readme
@codacy/tools-lizard-1
Table of Contents
Overview
Code complexity analyzer using the Lizard Python tool. Uses the CLI execution strategy -- spawns lizard via spawnTool() and parses its plain-text output.
Unlike standard linters that emit rule violations, Lizard reports raw metrics (NLOC, CCN, parameter count). The adapter transforms these metrics into issues by applying configurable thresholds at three severity tiers (minor, medium, critical).
| Property | Value |
| ------------- | ------------------------------------------------------------------------------------------------------------- |
| Tool ID | Lizard |
| Codacy UUID | 76348462-84b3-409a-90d3-955e90abfb87 |
| Strategy | CLI |
| Languages | C, C++, C#, Go, Java, JavaScript, Kotlin, Lua, Objective-C, PHP, Python, Ruby, Rust, Scala, Swift, TypeScript |
| Binary | lizard (Python pip package) |
| Pattern count | 12 (3 metrics x 3 severity tiers + 3 file-level) |
| Prerequisites | Python 3 |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonPattern IDs follow the format Lizard_ccn-medium, Lizard_nloc-critical, Lizard_file-nloc-minor, etc.
Updating the Lizard version
- Update
preferredVersioninsrc/adapter.ts - Update the
PIP_PACKAGEconstant to match - Run
pnpm prefetchto check for any pattern changes - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
lizard-2/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (some require lizard in PATH)Installing lizard locally:
pip install lizard==1.21.2Or let the adapter install it automatically via --install-dependencies.
Notes for maintainers
- Lizard outputs plain text (not JSON/XML). The adapter parses two sections: methods and files.
- The
-Vflag enables verbose function names;-freads a file list from a temporary file. - No threshold flags are passed to lizard -- the adapter applies its own thresholds from Codacy pattern parameters.
- Each pattern has a single
thresholdparameter. If not provided, defaults are used. - Thresholds are checked in descending severity order (critical -> medium -> minor). Only the highest severity match is emitted per metric group per function/file.
- A single function can produce up to 3 issues (one per metric: NLOC, CCN, parameter count).
- File-level NLOC issues are reported at line 1.
- Lizard has no configuration file format --
checkLocalConfigurationFilealways returns{ found: false }. - The adapter uses Python venv utilities from
@codacy/tooling(findPython,ensureVenv,pipInstall) for installation. - The
lineContentfield is empty for Lizard issues because the issue refers to a whole function, not a specific line of code.
