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

Allow Rails attribute in EmptyLinesAroundAttributeAccessor #7981

Closed
legendetm opened this issue May 15, 2020 · 3 comments
Closed

Allow Rails attribute in EmptyLinesAroundAttributeAccessor #7981

legendetm opened this issue May 15, 2020 · 3 comments
Assignees

Comments

@legendetm
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I prefer to group all attributes together including ActiveModel::Attributes#attributes

  attr_accessor :foo
  attr_reader :bar
  attr_writer :baz
  attribute :time, :datetime

Describe the solution you'd like

I would expect that EmptyLinesAroundAttributeAccessor allow to group attribute with other accessors

Additional context

Add any other context or screenshots about the feature request here.

@koic
Copy link
Member

koic commented May 16, 2020

This issue similar to #7976. I've opened #7982. Rails-specific methods will be configured by user applications or RuboCop Rails gem using IgnoredMethods option because RuboCop core is focused on Ruby.

@koic koic self-assigned this May 16, 2020
@legendetm
Copy link
Contributor Author

Yes I know, that RuboCop is Ruby specific and the IgnoredMethods option is suitable

koic added a commit to koic/rubocop that referenced this issue May 17, 2020
…ributeAccessor`

Fixes rubocop#7976 and rubocop#7981

This PR adds `AllowAliasSyntax` and `AllowedMethods` options.
for `Layout/EmptyLinesAroundAttributeAccessor` cop.

Users can configure a behavior for `alias` syntax using
`IgnoreAliasSyntax` option. Ignored by default (true).

And users can specify ignored methods using `AllowedMethods`.
By default, set `alias_method`, `public`, `protected`, and
`private` provided by Ruby.

`cattr_accessor`, `attribute`, other methods provided by Rails (and other gems)
can be set by user applications or RuboCop Rails gem.
bbatsov pushed a commit that referenced this issue May 17, 2020
…ccessor`

Fixes #7976 and #7981

This PR adds `AllowAliasSyntax` and `AllowedMethods` options.
for `Layout/EmptyLinesAroundAttributeAccessor` cop.

Users can configure a behavior for `alias` syntax using
`IgnoreAliasSyntax` option. Ignored by default (true).

And users can specify ignored methods using `AllowedMethods`.
By default, set `alias_method`, `public`, `protected`, and
`private` provided by Ruby.

`cattr_accessor`, `attribute`, other methods provided by Rails (and other gems)
can be set by user applications or RuboCop Rails gem.
@koic
Copy link
Member

koic commented May 17, 2020

#7981 has been merged. IgnoredMethods renamed to AllowedMethods. Thank you.

@koic koic closed this as completed May 17, 2020
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

No branches or pull requests

2 participants