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 #8664] Fix a false positive for Naming/BinaryOperatorParameterName #8665

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@
* [#8655](https://github.com/rubocop-hq/rubocop/pull/8655): Fix a false positive for `Style/ClassAndModuleChildren` when using cbase class name. ([@koic][])
* [#8654](https://github.com/rubocop-hq/rubocop/pull/8654): Fix a false positive for `Style/SafeNavigation` when checking `foo&.empty?` in a conditional. ([@koic][])
* [#8660](https://github.com/rubocop-hq/rubocop/pull/8660): Fix a false positive for `Style/ClassAndModuleChildren` when using cbase module name. ([@koic][])
* [#8664](https://github.com/rubocop-hq/rubocop/issues/8664): Fix a false positive for `Naming/BinaryOperatorParameterName` when naming multibyte character method name. ([@koic][])

### Changes

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/naming/binary_operator_parameter_name.rb
Expand Up @@ -35,7 +35,7 @@ def on_def(node)
def op_method?(name)
return false if EXCLUDED.include?(name)

!/\A\w/.match?(name) || OP_LIKE_METHODS.include?(name)
!/\A[[:word:]]/.match?(name) || OP_LIKE_METHODS.include?(name)
end
end
end
Expand Down
Expand Up @@ -81,6 +81,14 @@ def ===(string)
RUBY
end

it 'does not register an offense for multibyte character method name' do
expect_no_offenses(<<~RUBY)
def do_something(string)
string
end
RUBY
end

it 'does not register an offense for non binary operators' do
expect_no_offenses(<<~RUBY)
def -@; end
Expand Down