== Why is this an issue?

Shadowing occurs when a local variable has the same name as a variable, field, or `enum case` in an outer scope.

include::../problems.adoc[]

To avoid these problems, rename the shadowing, shadowed, or both identifiers to accurately represent their purpose with unique and meaningful names.
It improves clarity and allows reasoning locally about the code without considering other software parts.

This rule focuses on variables shadowing fields or ``enum case``s.

=== Noncompliant code example

[source,swift]
----
public class Foo {
  public var myField:Int = 0

  public func doSomething() {
    var myField = 0 /// Noncompliant
    // ...
  }
}
----

include::../rspecator.adoc[]