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

Added IgnoredMethods configuration to Style/CombinableLoops #8852

Conversation

dvandersluis
Copy link
Member

Related to #8848, it probably makes sense to make Style/CombinableLoops use IgnoredMethods, since it's possible to have a method that matches the method name conditions without being combinable.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • 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.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@dvandersluis dvandersluis force-pushed the change/combinable-loop-ignored-methods branch from defa89b to 1a0c1b3 Compare October 4, 2020 17:20
@marcandre
Copy link
Contributor

Now that #8851 is merged, your example no longer works (methods have different arguments)...

@dvandersluis
Copy link
Member Author

@marcandre oops, thanks! I had changed the test but not the example, I’ll fix it.

@dvandersluis dvandersluis force-pushed the change/combinable-loop-ignored-methods branch from 1a0c1b3 to 01ffcce Compare October 4, 2020 21:37
@dvandersluis
Copy link
Member Author

@marcandre updated!

@marcandre
Copy link
Contributor

Cool. Now why should these two validates_each not be combined?

@dvandersluis
Copy link
Member Author

@marcandre definitely true that you could. I was trying to come up with an example of something you might not want to combine despite being able to, this is maybe not the best example though.

Overall for this I was just thinking based on the original issue that there is a use case to make this cop less restrictive without having to be manually disabled (because the cop just looks for a method that starts or ends with each but it’s conceivable that there are methods that match that aren’t enumerators).

@marcandre
Copy link
Contributor

marcandre commented Oct 5, 2020 via email

@dvandersluis
Copy link
Member Author

dvandersluis commented Oct 5, 2020

To be fair, we didn't have the report about different arguments, I discovered it while trying to replicate the original issue 😁. This PR was my first attempt at fixing it (since the example provided in the issue wasn't actually failing) which I split off once I discovered that there actually was a legit issue that could be fixed (the arguments).

I figured it could still be valuable so I split it out of my original branch and put it up by itself so we could have this exact discussion. I'm ok with closing this though if you don't think it's necessary!

@dvandersluis dvandersluis force-pushed the change/combinable-loop-ignored-methods branch from 01ffcce to 1e66f43 Compare October 9, 2020 00:43
@bbatsov
Copy link
Collaborator

bbatsov commented Nov 4, 2020

I'm leaning towards closing the PR at this point, as I'm not sure it solves an actual problem. We can revisit it down the road if the need to do so arises.

@bbatsov bbatsov closed this Nov 4, 2020
@dvandersluis dvandersluis deleted the change/combinable-loop-ignored-methods branch January 18, 2021 20:42
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.

None yet

3 participants