Open ikelax opened 2 months ago
17 Messages | |
---|---|
:book: | Linting Aerial with this PR took 0.79s vs 0.8s on main (1% faster) |
:book: | Linting Alamofire with this PR took 1.13s vs 1.15s on main (1% faster) |
:book: | Linting Brave with this PR took 6.6s vs 6.66s on main (0% faster) |
:book: | Linting DuckDuckGo with this PR took 3.52s vs 3.47s on main (1% slower) |
:book: | Linting Firefox with this PR took 9.49s vs 9.37s on main (1% slower) |
:book: | Linting Kickstarter with this PR took 8.72s vs 8.46s on main (3% slower) |
:book: | Linting Moya with this PR took 0.49s vs 0.48s on main (2% slower) |
:book: | Linting NetNewsWire with this PR took 2.45s vs 2.37s on main (3% slower) |
:book: | Linting Nimble with this PR took 0.69s vs 0.68s on main (1% slower) |
:book: | Linting PocketCasts with this PR took 6.97s vs 7.08s on main (1% faster) |
:book: | Linting Quick with this PR took 0.33s vs 0.33s on main (0% slower) |
:book: | Linting Realm with this PR took 4.29s vs 4.23s on main (1% slower) |
:book: | Linting Sourcery with this PR took 2.12s vs 2.09s on main (1% slower) |
:book: | Linting Swift with this PR took 3.91s vs 3.97s on main (1% faster) |
:book: | Linting VLC with this PR took 1.12s vs 1.1s on main (1% slower) |
:book: | Linting Wire with this PR took 14.68s vs 14.54s on main (0% slower) |
:book: | Linting WordPress with this PR took 9.72s vs 9.86s on main (1% faster) |
Generated by :no_entry_sign: Danger
I added a Rewriter
for fixing this automatically. Also, I checked the findings of SwiftLintBot. As far as I can tell, there is not anything that speaks against this rule.
So I wrote #5649 the other day because I had not spotted this PR. I've left mine open as a draft - please feel free to steal anything you like from it - I overrode visitPost(_ node: UnresolvedAsExprSyntax)
, and then look at the siblings of the parent ExprListSyntax
to look for != nil
, which might be a bit more efficient that looking at every ExprListSyntax
(although I have not measured that).
I think the solutions are quite similar, but mine seem to pick up 26 OSS violations, versus 10 for this branch. When I looked at a couple, they did not seem to be false alarms. For example
and
Thank you. I prefer your idea so far. As soon as I am free again, I will work on it.
Addresses #5295.
This new rule triggers on code like
which can be replaced by
or
However, so far there is not a Rewriter for fixing this automatically. If I am not mistaken, a as? Dog != nil can always be replaced by a is Dog.