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

[Fix #7647] Handle numblock #7665

Merged
merged 1 commit into from Jan 28, 2020
Merged

[Fix #7647] Handle numblock #7665

merged 1 commit into from Jan 28, 2020

Conversation

hanachin
Copy link
Contributor

@hanachin hanachin commented Jan 24, 2020

Fix #7647

# 7647/.rubocop.yml
AllCops:
  TargetRubyVersion: 2.7
#!/usr/bin/env ruby
# frozen_string_literal: true

# 7647/test.rb

def hello(meaning)
  spliters = [',', '.', '!']
  spliters.each { meaning = meaning.split(_1).first }
  meaning.delete('"').strip.gsub("\r\n", '; ')
end
$ pwd
/home/sei/src/github.com/rubocop-hq/rubocop
$ cd 7647
$ ../exe/rubocop
Inspecting 1 file
.

1 file inspected, no offenses detected

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.

@pocke
Copy link
Collaborator

pocke commented Jan 24, 2020

Thanks for your pull request 👍

We still need to apply more changes to make cops to work for numblock even if we merge this pull request. Because the cops will just ignore numblock.
I created an issue for the problem. #7666 See the issue for more detail.

I think this pull request is acceptable without more support for numblock. We can work for #7666 with another pull request.
This bug is critical for Ruby 2.7 users. But #7666 is a smaller problem than the bug. So I think we can fix the cops after this pull request.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
@@ -6,6 +6,7 @@

* [#7639](https://github.com/rubocop-hq/rubocop/pull/7639): Fix logical operator edge case in `omit_parentheses` style of `Style/MethodCallWithArgsParentheses`. ([@gsamokovarov][])
* [#7661](https://github.com/rubocop-hq/rubocop/pull/7661): Fix to return correct info from multi-line regexp. ([@Tietew][])
* [#7647](https://github.com/rubocop-hq/rubocop/issues/7647): Handle numblock. ([@hanachin][])
Copy link
Member

Choose a reason for hiding this comment

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

As @pocke mentions at #7665 (comment), this patch doesn't solve all known issue of numblock. So the Handle numblock seems a bit broad sense to me. What about alternatives like the following message focused on resolving the error?

-* [#7647](https://github.com/rubocop-hq/rubocop/issues/7647): Handle numblock. ([@hanachin][])
+* [#7647](https://github.com/rubocop-hq/rubocop/issues/7647): Fix an `undefined method on_numblock` error when using Ruby 2.7's numbered parameters. ([@hanachin][])

@hanachin hanachin force-pushed the fix_7647 branch 2 times, most recently from e652c25 to bca75ce Compare January 28, 2020 08:57
when using Ruby 2.7's numbered parameters
Copy link
Collaborator

@pocke pocke left a comment

Choose a reason for hiding this comment

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

👍

@koic koic merged commit 7b3639b into rubocop:master Jan 28, 2020
@koic
Copy link
Member

koic commented Jan 28, 2020

Thanks!

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.

Error on TargetRubyVersion 2.7: undefined method `on_numblock'
3 participants