none) or low.
It runs lizard 1.26.1 (MIT) as an
engine, alongside the vulnerability, secret and static-analysis engines, in the
same repository or filesystem scan. The code is
backend/internal/scanner/lizard.
What is measured
For each function, lizard reports three numbers, and the scanner compares them with fixed thresholds:
“Over” is strictly greater: a function with a complexity of exactly 15 is not
reported. A file’s severity is low when any of its functions is over a low
threshold, otherwise info. The thresholds are the same for every
organization; they cannot be changed per organization yet.
Not measured: duplicated code (lizard can find it, but its duplicate search is
slow on large repositories), cognitive complexity, nesting depth, comment
density, and test coverage.
lizard parses the languages its 1.26.1 release lists, among them C and C++,
C#, Java, Kotlin, Scala, JavaScript, TypeScript (including TSX and Vue), Python,
Go, Rust, Swift, Objective-C, Ruby, PHP, Lua, Dart and Solidity. Its parsers
read structure rather than compiling, so an unusual construct can be measured
slightly differently from a compiler’s view.
What is skipped
- Paths the repository’s own
.gitignoreexcludes. node_modules,vendor,third_party,distandbuilddirectories,.git, and*.min.jsfiles: dependencies and build output nobody refactors.- Any skip paths the scan request names.
How findings are reported
One finding per file, of kindcode_quality, with the identifier
quality.functions (its catalogue entry). The
title says how many of the file’s functions are over a threshold, and the
detail lists the ten worst (highest complexity first) with their start and end
lines, complexity, lines of code, parameter count and which thresholds each is
over.
A scan reports at most 200 files, worst first (low severity before info,
then by highest complexity). When more are over a threshold, the scan carries a
warning saying how many were left out.
A file’s finding is identified by its path alone, so editing a function in it
keeps the same finding (and its triage state) with updated numbers. When no
function in the file is over a threshold any more, the next scan that runs the
scanner resolves it.
Where to see it
- The repository page (Assets, then the repository) has a Code quality card: how many files and functions are over a threshold, the highest complexity and the longest function, and the five worst functions, each linked to its finding. It says Not measured when the last scan did not run the scanner, rather than showing a clean result.
- Code security → Code quality lists the findings across every repository.
- The findings API:
GET /api/v1/findings?kind=code_quality.
Enabling it
The scanner needs thelizard program, which the published
trustowl-backend image does not include. backend/Dockerfile.sast, the
analyser image built on top of the published one for
static analysis, installs a pinned lizard in
its own Python environment. There is no setting: a worker whose image has
lizard on PATH offers the scanner, and one without it logs that code
quality is unavailable at startup and does not offer it.
SCANNER_OFFLINE), because measuring it needs a clone; a filesystem
target is measured offline.
Turning it on for an organization
Like static analysis, it is off until an organization selects it. An administrator ticks Code quality in Settings → Data and evidence → Repository scanners and saves, or over the API:quality in its scanners. A
deployment that cannot run lizard refuses quality with 400.