Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont trigger for non-optional type casting, or for optional types #5805

Merged

Conversation

mildm8nnered
Copy link
Collaborator

@mildm8nnered mildm8nnered commented Sep 21, 2024

Addresses #5802

We no longer trigger unless the type casting is optional (as?), or if the type is optional.

Essentially, in either case, the correction would change the resulting true or false value. See #5802 for details.

We also now check for nil != foo as? Bar cases

@SwiftLintBot
Copy link

SwiftLintBot commented Sep 21, 2024

1 Warning
⚠️ This PR introduced a violation in Realm: /Realm/ObjectServerTests/ClientResetTests.swift:284:36: warning: Prefer Type Checking Violation: Prefer a is X to a as? X != nil (prefer_type_checking)
17 Messages
📖 Linting Aerial with this PR took 0.18s vs 0.2s on main (10% faster)
📖 Linting Alamofire with this PR took 0.17s vs 0.18s on main (5% faster)
📖 Linting Brave with this PR took 0.73s vs 0.76s on main (3% faster)
📖 Linting DuckDuckGo with this PR took 0.54s vs 0.54s on main (0% slower)
📖 Linting Firefox with this PR took 1.49s vs 1.46s on main (2% slower)
📖 Linting Kickstarter with this PR took 0.86s vs 0.85s on main (1% slower)
📖 Linting Moya with this PR took 0.13s vs 0.13s on main (0% slower)
📖 Linting NetNewsWire with this PR took 0.34s vs 0.34s on main (0% slower)
📖 Linting Nimble with this PR took 0.14s vs 0.14s on main (0% slower)
📖 Linting PocketCasts with this PR took 0.82s vs 0.84s on main (2% faster)
📖 Linting Quick with this PR took 0.12s vs 0.12s on main (0% slower)
📖 Linting Realm with this PR took 0.45s vs 0.45s on main (0% slower)
📖 Linting Sourcery with this PR took 0.3s vs 0.31s on main (3% faster)
📖 Linting Swift with this PR took 0.49s vs 0.5s on main (2% faster)
📖 Linting VLC with this PR took 0.22s vs 0.22s on main (0% slower)
📖 Linting Wire with this PR took 1.79s vs 1.81s on main (1% faster)
📖 Linting WordPress with this PR took 1.24s vs 1.26s on main (1% faster)

Generated by 🚫 Danger

@mildm8nnered mildm8nnered force-pushed the mildm8nnered-prefer-type-checking-fix branch from 2020e54 to 4999b47 Compare September 21, 2024 18:47
@mildm8nnered mildm8nnered marked this pull request as ready for review September 22, 2024 01:47
@mildm8nnered mildm8nnered force-pushed the mildm8nnered-prefer-type-checking-fix branch from 4999b47 to efa6b93 Compare September 29, 2024 22:16
@mildm8nnered mildm8nnered force-pushed the mildm8nnered-prefer-type-checking-fix branch from efa6b93 to 1b33458 Compare October 5, 2024 17:23
@SimplyDanny SimplyDanny linked an issue Oct 7, 2024 that may be closed by this pull request
2 tasks
@mildm8nnered mildm8nnered force-pushed the mildm8nnered-prefer-type-checking-fix branch from 63e1ee5 to bddd8c2 Compare October 8, 2024 18:03
@mildm8nnered mildm8nnered merged commit 9ebd6ae into realm:main Oct 11, 2024
14 checks passed
@mildm8nnered mildm8nnered deleted the mildm8nnered-prefer-type-checking-fix branch October 11, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prefer_type_checking and optional types violation
4 participants