ALL-FUNC0010 · required_parameter_count
Count the inputs a caller must supply to one callable.
This is a deterministic rule for all languages. Read its implementation.
Definition
Section titled “Definition”Count the declared parameters that carry no default and are not the receiver. A long required list is the readable symptom of a callable that owns several responsibilities, or of a missing type that should carry the values together. The count excludes optional parameters because a caller never has to think about them, and excludes the receiver because it is not a decision the caller makes.
Evidence
Section titled “Evidence”The finding records the callable range, every counted parameter by name, and how many of the declared parameters those required ones are. It is stated for every callable rather than only for a wide one, because the measurement is the whole answer and a reader has to be able to see which inputs it counted. The value is the number of required inputs.
Exceptions
Section titled “Exceptions”A constructor that assembles a value from its parts, a mathematical function over independent scalars, and a framework entry point with a fixed contract all legitimately take several inputs. The count is a measurement and the policy owns the ceiling.
Examples
Section titled “Examples”def render(template, context, encoding="utf-8") returns 2. A method whose only parameter is
its receiver returns 0.
References
Section titled “References”- Generalizes Clippy too_many_arguments. Open reference
- Generalizes typescript-eslint max-params. Open reference
- Cites Pylint R0913 too-many-arguments. Open reference