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 #7976] Add ignore options for Layout/EmptyLinesAroundAttributeAccessor
#7982
[Fix #7976] Add ignore options for Layout/EmptyLinesAroundAttributeAccessor
#7982
Conversation
d7eeef6
to
35c311d
Compare
35c311d
to
c8cc5b9
Compare
config/default.yml
Outdated
@@ -468,6 +468,13 @@ Layout/EmptyLinesAroundAttributeAccessor: | |||
StyleGuide: '#empty-lines-around-attribute-accessor' | |||
Enabled: pending | |||
VersionAdded: '0.83' | |||
VersionChanged: '1.0' | |||
IgnoreAliasSyntax: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather use Allow
and Allowed
here.
@@ -4,6 +4,8 @@ module RuboCop | |||
module Cop | |||
module Layout | |||
# Checks for a newline after attribute accessor. | |||
# `alias` syntax and `alias_method`, `public`, `protected`, and `private` methods are ignored by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also be more specific in the initial sentence - it's an attribute accessor or a group of them.
Good work! Probably at some point we should have something more generic for other macros that are typically grouped together. |
c8cc5b9
to
872af14
Compare
Yeah, I update this PR. |
config/default.yml
Outdated
@@ -468,6 +468,13 @@ Layout/EmptyLinesAroundAttributeAccessor: | |||
StyleGuide: '#empty-lines-around-attribute-accessor' | |||
Enabled: pending | |||
VersionAdded: '0.83' | |||
VersionChanged: '1.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also change this to 0.84.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I updated it!
…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.
872af14
to
aad52dd
Compare
Follow up rubocop#7982.
Fixes #7976 and #7981
This PR adds
IgnoreAliasSyntax
andIgnoredMethods
options forLayout/EmptyLinesAroundAttributeAccessor
.Users can configure a behavior for
alias
syntax usingIgnoreAliasSyntax
option. Ignored by default (true).And users can specify ignored methods using
IgnoredMethods
. By default, setalias_method
,public
,protected
, andprivate
provided by Ruby.cattr_accessor
,attribute
, other methods provided by Rails (and other gems) can be set by user applications or RuboCop Rails gem.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.