ALL-FUNC0005 · transparent_unary_wrapper
Detect a public unary function that only forwards one argument.
This is a deterministic rule for all languages. Read its implementation.
Definition
Section titled “Definition”Report a synchronous public module function or static method only when it has one required parameter and its sole executable statement returns one call with that parameter unchanged. A direct callable alias or direct call expresses the same dispatch without another boundary.
Evidence
Section titled “Evidence”Each finding identifies the wrapper, forwarded callable, and complete source range. The rule does not infer semantic similarity or inspect nested behavior.
Exceptions
Section titled “Exceptions”Instance methods, class methods, private helpers, asynchronous adapters, decorators other than
staticmethod, overloads, defaults, argument adaptation, result transformation, and recursive
calls are excluded. A narrowing annotation alone does not preserve a wrapper when the called
function already exposes the same narrowing contract. Keep a wrapper when its distinct
__name__, signature, documentation, instrumentation, or compatibility boundary is an
intentional public contract.
Examples
Section titled “Examples”Bad
`def normalize(value: str) -> str: return inflection.underscore(value)` adds only a forwardingframe.
Goodnormalize = inflection.underscore gives the callable a project name directly. A function
that validates, transforms, logs, awaits, or combines arguments remains a real boundary.
Inside a method, call inspect.isclass(value) directly instead of wrapping it as is_class.
References
Section titled “References”- Cites “The Python Language Reference”, assignment statements. Open reference
- Cites “A Philosophy of Software Design”, chapters 4 and 7
- Cites “Clean Code”, chapter 3