realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.45k stars 2.2k forks source link

Added prefer_type_checking rule #5649

Open mildm8nnered opened 1 day ago

mildm8nnered commented 1 day ago

I wrote this unaware of #5561

I think that PR should take precedence over this one, but I'm just leaving this here in case @ikelax wants to steal anything from it.

SwiftLintBot commented 1 day ago
27 Warnings
:warning: If this is a user-facing change, please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift:2167:81: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift:451:41: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift:462:41: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Browser/TabDisplayManager.swift:457:46: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Browser/TabDisplayManager.swift:700:29: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Home/HomepageContextMenuHelper.swift:271:24: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Home/HomepageViewController.swift:325:36: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Home/TopSites/DataManagement/TopSitesDataAdaptor.swift:183:19: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Library/HistoryPanel/HistoryPanel.swift:548:17: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Settings/SettingsTableViewController.swift:1012:20: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/TabContentsScripts/LoginsHelper.swift:326:35: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/TabContentsScripts/LoginsHelper.swift:327:37: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Widgets/SiteTableViewController.swift:112:41: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Widgets/SiteTableViewController.swift:54:17: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Kickstarter: /Library/TestHelpers/MockStripeIntentService.swift:17:41: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Kickstarter: /Library/TestHelpers/MockStripeIntentService.swift:37:41: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Nimble: /Sources/Nimble/Matchers/MatchError.swift:62:24: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Realm: /RealmSwift/Impl/SchemaDiscovery.swift:157:27: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Realm: /RealmSwift/Realm.swift:1375:30: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Sourcery: /SourceryTests/Stub/Performance-Code/Kiosk/App/AppViewController.swift:79:36: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Swift: /stdlib/public/core/BridgeObjectiveC.swift:819:25: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Wire: /wire-ios-request-strategy/Tests/Sources/Payloads/Processing/ConversationEventPayloadProcessorTests.swift:1375:76: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Components/Views/MarkdownTextView+Recognizers.swift:41:61: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in WordPress: /WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController.swift:788:52: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in WordPress: /WordPress/Classes/ViewRelated/Notifications/Tools/NotificationMediaDownloader.swift:98:88: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
:warning: This PR introduced a violation in WordPress: /WordPress/Classes/ViewRelated/Reader/ReaderCardsStreamViewController.swift:256:18: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
17 Messages
:book: Linting Aerial with this PR took 0.99s vs 0.99s on main (0% slower)
:book: Linting Alamofire with this PR took 1.37s vs 1.36s on main (0% slower)
:book: Linting Brave with this PR took 8.09s vs 8.08s on main (0% slower)
:book: Linting DuckDuckGo with this PR took 4.46s vs 4.48s on main (0% faster)
:book: Linting Firefox with this PR took 11.4s vs 11.45s on main (0% faster)
:book: Linting Kickstarter with this PR took 10.08s vs 10.14s on main (0% faster)
:book: Linting Moya with this PR took 0.56s vs 0.56s on main (0% slower)
:book: Linting NetNewsWire with this PR took 2.79s vs 2.79s on main (0% slower)
:book: Linting Nimble with this PR took 0.82s vs 0.81s on main (1% slower)
:book: Linting PocketCasts with this PR took 8.59s vs 8.82s on main (2% faster)
:book: Linting Quick with this PR took 0.46s vs 0.46s on main (0% slower)
:book: Linting Realm with this PR took 5.07s vs 5.1s on main (0% faster)
:book: Linting Sourcery with this PR took 2.54s vs 2.54s on main (0% slower)
:book: Linting Swift with this PR took 4.97s vs 4.94s on main (0% slower)
:book: Linting VLC with this PR took 1.34s vs 1.34s on main (0% slower)
:book: Linting Wire with this PR took 19.22s vs 19.18s on main (0% slower)
:book: Linting WordPress with this PR took 14.3s vs 14.3s on main (0% slower)

Here's an example of your CHANGELOG entry:

* Added prefer_type_checking rule.  
  [mildm8nnered](https://github.com/mildm8nnered)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by :no_entry_sign: Danger