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

Add unused_enumerated rule #998

Merged
merged 3 commits into from
Dec 18, 2016
Merged

Add unused_enumerated rule #998

merged 3 commits into from
Dec 18, 2016

Conversation

marcelofabri
Copy link
Collaborator

Fixes #619

@codecov-io
Copy link

codecov-io commented Dec 18, 2016

Current coverage is 82.14% (diff: 86.27%)

Merging #998 into master will increase coverage by 0.04%

@@             master       #998   diff @@
==========================================
  Files           136        137     +1   
  Lines          6447       6501    +54   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           5293       5340    +47   
- Misses         1154       1161     +7   
  Partials          0          0          

Powered by Codecov. Last update 5e2cb53...88e724b

Copy link
Collaborator

@jpsim jpsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍. Awesome! Although the comment in #619 still applies, and this will falsely trigger on enumerated() functions other than the ones in the standard library. But I think that'll be rare enough in practice to keep this rule enabled by default.

Feel free to merge once you add the non-triggering example I recommended.

name: "Unused Enumerated",
description: "When the index is not used, .enumerated() can be removed.",
nonTriggeringExamples: [
"for (idx, foo) in bar.enumerated() { }\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be useful to add a for (idx, _) in bar.enumerated() { }\n non-triggering example.

@marcelofabri marcelofabri merged commit 619f5d4 into realm:master Dec 18, 2016
@marcelofabri marcelofabri deleted the unused-enumerated branch December 18, 2016 03:08
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.

3 participants