Skip to content

Commit

Permalink
Remove @IBOutlet and @IBInspectable from UnusedDeclarationRule (#3432)
Browse files Browse the repository at this point in the history
The original implementation wasn't tested so it regressed.

#3184
  • Loading branch information
keith authored Dec 3, 2020
1 parent 0c5136d commit 03f13e5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@

#### Bug Fixes

* None.
* Remove `@IBOutlet` and `@IBInspectable` from UnusedDeclarationRule.
[Keith Smiley](https://github.com/keith)
[#3184](https://github.com/realm/SwiftLint/issues/3184)

## 0.41.0: World’s Cleanest Voting Booth

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ private let declarationKindsToSkip: Set<SwiftDeclarationKind> = [

private let declarationAttributesToSkip: Set<SwiftDeclarationAttributeKind> = [
.ibaction,
.ibinspectable,
.iboutlet,
.main,
.nsApplicationMain,
.override,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@ struct UnusedDeclarationRuleExamples {
func applicationWillFinishLaunching(_ notification: Notification) {}
func applicationWillBecomeActive(_ notification: Notification) {}
}
"""),
Example("""
import Foundation
public final class Foo: NSObject {
@IBAction private func foo() {}
}
"""),
Example("""
import Foundation
public final class Foo: NSObject {
@objc func foo() {}
}
""")
]

Expand All @@ -146,6 +160,20 @@ struct UnusedDeclarationRuleExamples {
func applicationWillFinishLaunching(_ notification: Notification) {}
func applicationWillBecomeActive(_ notification: Notification) {}
}
"""),
Example("""
import Foundation
public final class Foo: NSObject {
@IBOutlet var ↓bar: NSObject!
}
"""),
Example("""
import Foundation
public final class Foo: NSObject {
@IBInspectable var ↓bar: String!
}
""")
]
#else
Expand Down

0 comments on commit 03f13e5

Please sign in to comment.