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 autocorrect to Style/EachForSimpleLoop cop #3200

Merged

Conversation

tejasbubane
Copy link
Contributor

cc @alexdowad


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it)
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

@tejasbubane tejasbubane force-pushed the autocorrect-each-for-simple-loop branch from 9a8cede to ed02663 Compare June 6, 2016 13:58
end
end

def_node_matcher :bad_each_loop, <<-PATTERN
Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 "node matcher" methods can be combined. The fact that one of them returns an integer doesn't stop it from also being used as a predicate.

@alexdowad
Copy link
Contributor

Wow, I just introduced this cop a couple of days ago and already it has autocorrect! Awesome! Thanks @tejasbubane!

@tejasbubane tejasbubane force-pushed the autocorrect-each-for-simple-loop branch from ed02663 to 2fa34d8 Compare June 7, 2016 07:01
@bbatsov bbatsov merged commit 2b95be3 into rubocop:master Jun 8, 2016
@tejasbubane tejasbubane deleted the autocorrect-each-for-simple-loop branch June 8, 2016 10:44
Neodelf pushed a commit to Neodelf/rubocop that referenced this pull request Oct 15, 2016
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