The same import appears more than once
ID |
scala.maintainability.duplicate_imports |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Redundancy |
Language |
Scala |
Description
Reports an import clause that is repeated verbatim later in the same file. Only the first occurrence has any effect; the rest are no-ops.
Rationale
A repeated import is dead text that survives merges and grows: it is the usual residue of two branches adding the same dependency, or of an editor’s auto-import running over a file whose import block was reordered by hand. It costs a reader time to check whether the second copy differs from the first, and it hides genuine changes in the import block behind noise in diffs.
The following code illustrates the pattern detected by this rule:
// FLAGGED: The same import appears more than once
import java.util.UUID
import java.time.Instant
import java.util.UUID