You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, this is an offend on Style/AccessModifierDeclarations. However, just for attr* helpers this style looks much cleaner than the default group style.
Describe the solution you'd like
After all the default group style of Style/AccessModifierDeclarations works well for normal def methods, that I don't want to change that to inline style. Therefore I think the best approach is to add a new option called Style/AllowModifiersOnAttrs similar to Style/AllowModifiersOnSymbols to allow inlined modifier on attr* methods.
Describe alternatives you've considered
Use the group style everywhere - the problem is that I think most of the developers would prefer to put the attr declarations together, and then normal methods together, in that case we need to toggle public and private back and forth like below:
classFooattr_accessor:aprivateattr_accessor:bpublic# <-- extra "public" to toggle group back and forthdefc;endprivatedefd;enddefe;endend
Use the inline style everywhere, the problem would be simply we don't want to add the modifier to each normal method.
Is your feature request related to a problem? Please describe.
In Ruby >=3.0, we can write the modifier and
attr_*
helpers inline like:Today, this is an offend on
Style/AccessModifierDeclarations
. However, just forattr*
helpers this style looks much cleaner than the default group style.Describe the solution you'd like
After all the default
group
style ofStyle/AccessModifierDeclarations
works well for normaldef
methods, that I don't want to change that toinline
style. Therefore I think the best approach is to add a new option calledStyle/AllowModifiersOnAttrs
similar toStyle/AllowModifiersOnSymbols
to allow inlined modifier onattr*
methods.Describe alternatives you've considered
Use the group style everywhere - the problem is that I think most of the developers would prefer to put the attr declarations together, and then normal methods together, in that case we need to toggle public and private back and forth like below:
Use the inline style everywhere, the problem would be simply we don't want to add the modifier to each normal method.
With a
Style/AllowModifiersOnAttrs
rule similar toStyle/AllowModifiersOnSymbols
, we would be able to write:Additional context
The text was updated successfully, but these errors were encountered: