Skip to content

Commit 949cfe9

Browse files
Add new variable_shadowing rule (#6568)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
1 parent a7878fc commit 949cfe9

9 files changed

Lines changed: 417 additions & 7 deletions

File tree

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ disabled_rules:
5050
- todo
5151
- trailing_closure
5252
- type_contents_order
53+
- variable_shadowing
5354
- vertical_whitespace_between_cases
5455

5556
# Configurations

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
[kapitoshka438](https://github.com/kapitoshka438)
5353
[#6045](https://github.com/realm/SwiftLint/issues/6045)
5454

55+
* Add `variable_shadowing` rule that flags when a variable declaration shadows
56+
an identifier from an outer scope.
57+
[nadeemnali](https://github.com/nadeemnali)
58+
[#6228](https://github.com/realm/SwiftLint/issues/6228)
59+
5560
### Bug Fixes
5661

5762
* Detect and autocorrect missing whitespace before `else` in `guard`

Source/SwiftLintBuiltInRules/Models/BuiltInRules.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public let builtInRules: [any Rule.Type] = [
240240
UnusedParameterRule.self,
241241
UnusedSetterValueRule.self,
242242
ValidIBInspectableRule.self,
243+
VariableShadowingRule.self,
243244
VerticalParameterAlignmentOnCallRule.self,
244245
VerticalParameterAlignmentRule.self,
245246
VerticalWhitespaceBetweenCasesRule.self,

0 commit comments

Comments
 (0)