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

Bug: Style/AccessModifierDeclarations fails with certain syntax #11102

Closed
johnnyshields opened this issue Oct 21, 2022 · 0 comments · Fixed by #11103
Closed

Bug: Style/AccessModifierDeclarations fails with certain syntax #11102

johnnyshields opened this issue Oct 21, 2022 · 0 comments · Fixed by #11103
Labels

Comments

@johnnyshields
Copy link

Given this code:

module MyModule
  extend self

  def my_method
  end
  
  singleton_methods.each { |method| module_function(method) }
end

Running rubocop produces this error:

An error occurred while Style/AccessModifierDeclarations cop was inspecting C:/workspace/my_file.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues

Mention the following information in the issue report:
1.37.0 (using Parser 3.1.2.1, rubocop-ast 1.23.0, running on ruby 3.1.1) [x64-mingw-ucrt]
@koic koic added the bug label Oct 21, 2022
koic added a commit to koic/rubocop that referenced this issue Oct 21, 2022
Fixes rubocop#11102.

This PR fixes an error for `Style/AccessModifierDeclarations`
when using access modifier in a block.

It wouldn't be expected to enforce a style on how it's used as a
method call within a block like this:

```ruby
module MyModule
  singleton_methods.each { |method| module_function(method) }
end
```
bbatsov pushed a commit that referenced this issue Oct 22, 2022
Fixes #11102.

This PR fixes an error for `Style/AccessModifierDeclarations`
when using access modifier in a block.

It wouldn't be expected to enforce a style on how it's used as a
method call within a block like this:

```ruby
module MyModule
  singleton_methods.each { |method| module_function(method) }
end
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants