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

Style/TrivialAccessors make unwanted changes #9771

Closed
kvokka opened this issue May 5, 2021 · 0 comments · Fixed by #9772
Closed

Style/TrivialAccessors make unwanted changes #9771

kvokka opened this issue May 5, 2021 · 0 comments · Fixed by #9772
Labels

Comments

@kvokka
Copy link

kvokka commented May 5, 2021

Expected behavior

no action

Actual behavior

Code:

  def foo(foo)
    @foo = foo
  end

is suggested to be replaced with attr_wrirer, but it's false suggestion (attention to = sign in def)

RuboCop version

1.12.1 (using Parser 3.0.1.0, rubocop-ast 1.4.1, running on ruby 2.7.2 x86_64-darwin19)
@koic koic added the bug label May 5, 2021
koic added a commit to koic/rubocop that referenced this issue May 10, 2021
Fixes rubocop#9771.

This PR changes `AllowDSLWriters` to true by default because
it's still a trivial accessor and most people are unlikely to be
creating DSLs.

By this will prevent a false positive for `Style/TrivialAccessors`
when defining a method that is not a DSL writer.
bbatsov pushed a commit that referenced this issue May 10, 2021
Fixes #9771.

This PR changes `AllowDSLWriters` to true by default because
it's still a trivial accessor and most people are unlikely to be
creating DSLs.

By this will prevent a false positive for `Style/TrivialAccessors`
when defining a method that is not a DSL writer.
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