pretender
Pretender is a Rust CLI for structural code-quality checks across multiple languages.
Documentation
Commands
| Command | Description |
|---|---|
pretender init |
Interactive wizard: write pretender.toml, install hook, generate CI |
pretender check <paths...> |
Fast pass/fail scan against configured thresholds |
pretender complexity <path> |
Show cyclomatic complexity per function, sorted worst-first |
pretender report |
Render cached last check as human, markdown, or HTML |
pretender duplication <paths...> |
Structural clone detection via AST subtree hashing |
pretender mutation <paths...> |
Mutation testing wrapper (mutmut / cargo-mutants / Stryker / PIT) |
pretender hooks install|uninstall |
Install or remove the pre-commit hook |
pretender ci generate github |
Emit .github/workflows/pretender.yml |
pretender explain <metric> |
Print definition, threshold, and citation for a metric |
Check flags
pretender check <paths...> [flags]
--format human|json|sarif Output format (default: human)
--output <path> Write report to file instead of stdout
--mode guidance|tiered|gate Override pretender.toml mode
--staged Check only git-staged files
--diff-only Check only files changed vs --diff-base
--diff-base <ref> Base ref for --diff-only (default: origin/main)
Metrics
| Metric | Formula | Default threshold |
|---|---|---|
cyclomatic |
1 + decision points | 10 |
cognitive |
Nesting-weighted branch sum | 15 |
abc |
√(A²+B²+C²) | 30 |
function_lines |
end_line − start_line + 1 | 40 |
file_lines |
Total lines in file | 400 |
nesting_max |
Maximum control-flow depth | 3 |
params |
Formal parameter count | 4 |
min_assertions |
Assertions per test function | 1 (test role) |
Run pretender explain <metric> for full definition and citation.
Languages
Python, Rust, Go, JavaScript, TypeScript, Java, Ruby, C, C++
Configuration
[]
= "tiered" # guidance | tiered | gate
= ["auto"]
= ["vendor/**", "node_modules/**", "**/*_generated.*"]
[]
= 10
= 15
= 40
= 400
= 3
= 4
= 30
[]
= 3
= 5
= 1
[]
= 8
= 3
= 30
[]
= { = 10, = 15, = 20 }
= { = 15, = 25, = 40 }
Development
A note on authorship
All the code in this repository was generated by a large language model. This is not a confession, nor an apology. It's a fact, like the one that says water boils at a hundred degrees at sea level: neutral, technical, and with consequences one discovers later.
What the human did is what tends to happen before and after things come into existence: thinking. Reviewing requirements, arguing about edge cases, understanding what needs to be built and why, deciding how the system should behave when reality —which is capricious and does not read documentation— confronts it with situations nobody anticipated. The hours of planning, of design, of reading specifications until exhaustion dissolves the boundary between understanding and hallucination.
The LLM writes. The human knows what it should say.
There is a distinction, even if looking at the commit history makes it hard to find. The distinction is that a machine can produce correct code without understanding anything, the same way a calculator can solve an integral without knowing what time is. Understanding what that integral is for, whether it actually solves the problem, whether the problem was the right problem to begin with — that remains human territory. For now.