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

Check first argument label in reduce_boolean rule #4895

Merged
merged 1 commit into from
Apr 16, 2023

Conversation

SimplyDanny
Copy link
Collaborator

It's impossible to avoid all false-positives reported by this rule due to missing type information. This PR fixes #4894, but there are definitely more problematic cases.

It's also questionable if code like a.reduce(true) is enough information to conclude that the attached closure simply &&'s all conditions working on the elements.

@SwiftLintBot
Copy link

18 Messages
📖 Linting Aerial with this PR took 0.13s vs 0.13s on main (0% slower)
📖 Linting Alamofire with this PR took 0.1s vs 0.1s on main (0% slower)
📖 Linting Brave with this PR took 0.48s vs 0.49s on main (2% faster)
📖 Linting DuckDuckGo with this PR took 0.3s vs 0.29s on main (3% slower)
📖 Linting Firefox with this PR took 0.47s vs 0.47s on main (0% slower)
📖 Linting Kickstarter with this PR took 0.59s vs 0.59s on main (0% slower)
📖 Linting Moya with this PR took 0.12s vs 0.12s on main (0% slower)
📖 Linting NetNewsWire with this PR took 0.21s vs 0.21s on main (0% slower)
📖 Linting Nimble with this PR took 0.09s vs 0.09s on main (0% slower)
📖 Linting PocketCasts with this PR took 0.47s vs 0.47s on main (0% slower)
📖 Linting Quick with this PR took 0.06s vs 0.06s on main (0% slower)
📖 Linting Realm with this PR took 0.44s vs 0.44s on main (0% slower)
📖 Linting SourceKitten with this PR took 0.08s vs 0.08s on main (0% slower)
📖 Linting Sourcery with this PR took 0.2s vs 0.2s on main (0% slower)
📖 Linting Swift with this PR took 1.03s vs 1.02s on main (0% slower)
📖 Linting VLC with this PR took 0.14s vs 0.14s on main (0% slower)
📖 Linting Wire with this PR took 0.54s vs 0.55s on main (1% faster)
📖 Linting WordPress with this PR took 0.73s vs 0.73s on main (0% slower)

Generated by 🚫 Danger

@SimplyDanny SimplyDanny merged commit 5aed7ce into realm:main Apr 16, 2023
@SimplyDanny SimplyDanny deleted the reduce-boolean branch April 16, 2023 07:58
@mr-fixit
Copy link

thanks, @SimplyDanny!

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.

reduce_boolean triggers in cases where it shouldn't
3 participants