ALL-PARA0002 · configuration_object_parameter
Count parameters a callable only reads attributes from.
This is a deterministic rule for all languages. Read its implementation.
Definition
Section titled “Definition”Report a configuration parameter whose every resolved use is an attribute read, and which is
read for at least minimum_reads distinct names. A configuration type is identified by the
configurable, case-insensitive markers in its annotation. Such a parameter does not need the
object, only those values. Taking the whole object hides which parts the callable depends on,
forces every caller and every test to build a complete object, and couples the callable to a
type it never uses as a type.
Evidence
Section titled “Evidence”Each finding names the callable, the parameter, its declared type, and every attribute name the body reads from it, since those names are the narrower contract the callable actually wants. The repair is a choice, because a settings object a framework hands over is not one a caller can unpack. The value is the number of such parameters.
Exceptions
Section titled “Exceptions”A value object such as a source span is not configuration and is skipped even when a renderer
reads several of its fields. A parameter with any use other than an attribute read is skipped,
because the callable then depends on the object itself. A parameter whose uses could not all
be resolved is skipped rather than guessed. A project can replace configuration_markers,
raise minimum_reads, or disable the rule where a framework deliberately supplies settings.
Examples
Section titled “Examples”A function that reads only config.host and config.port returns 1 and should take those
two values. A function reading span.path and span.start_line returns 0, as does one that
reads config.host and also passes config onward.
References
Section titled “References”- Cites “Refactoring”, replace parameter with explicit methods
- Cites “Clean Code”, function arguments
- Cites “Implementation Patterns”, on revealing intent in signatures