builtin.size.param-count
| Field | Value |
|---|---|
| id | builtin.size.param-count |
| severity | warn |
| category | size |
| scope | file |
| languages | rust, python, go, java, typescript, tsx, javascript |
| evaluator | builtin / param_count |
Long parameter lists are a smell: usually the function is doing too much, or the call site is missing an aggregate type that should obviously exist. They’re also a maintenance hazard — every additional parameter multiplies the number of call sites that need updating when the contract changes.
Thresholds
Section titled “Thresholds”Configure under [size] in .sextant/config.toml:
[size]param_count_warn = 6param_count_error = 10| Setting | Default | Effect |
|---|---|---|
param_count_warn | 6 | Functions with this many parameters trigger a warn. |
param_count_error | 10 | Functions with this many escalate to error. |
The count is over declared parameters. &self / &mut self /
self count. Default arguments count.
Fixing a finding
Section titled “Fixing a finding”- Group related arguments into a struct (
Config,Options, request type). Two arguments that always travel together are already a struct in disguise. - Promote optional parameters into a builder if there are more than a few.
- For methods with many
&mut selfarguments plus extras, consider whether some of those extras belong as fields onSelf.
See also
Section titled “See also”builtin.size.fn-length— often co-occurs with high param count.- Configuration → size.