Skip to content

ALL-DEPE0003 · repeated_external_unary_transformation

Find repeated unary transformations performed directly by external packages.

This is a deterministic rule for all languages. Read its implementation.

Resolve absolute module and symbol imports to fully qualified third-party callables. Count calls whose final name identifies a configured transformation and that receive exactly one explicit positional argument with no keywords, then group identical callables across project files. Report a project-owned boundary candidate only after a group reaches both minimum_repetitions and minimum_files. Relative imports, standard-library imports, inferred or configured first-party modules, constructors, shadowed bindings, ambiguous aliases, decorator factories, starred arguments, and configured ignored_callables are excluded. transformation_names is the explicit semantic vocabulary that keeps ordinary API helpers out of this deterministic rule.

Each finding records the external callable, occurrence and file counts, every matching source location, and a stable project-boundary candidate identifier. The result value counts the eligible calls in groups that reach both configured floors. One-offs remain observable in the provider fact without becoming failures that have no finding.

A recognized operation and repetition still do not prove a useful domain abstraction. Ignore a callable when direct use is itself the project convention, extend transformation_names when the project uses another exact operation name, or raise the thresholds when a wrapper would only rename a stable dependency API. Configure additional first-party roots for nonstandard source layouts. first_party_modules names roots a nonstandard layout owns so its own code is not read as third party. Repository Git ignores decide which source files exist before this rule runs.

Bad

Calling `inflection.underscore(value)` in three modules couples project naming policy to the
external package at three sites.
Good

Define one project function such as python_name(value) that calls inflection.underscore(value), then depend on that named boundary. A single direct call or a call using keyword arguments does not trigger a finding.

  • Cites “Refactoring”, Extract Function. Open reference
  • Cites “Domain-Driven Design”, Anti-Corruption Layer
  • Cites “The Python Language Reference”, the import system. Open reference