-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add Layout/AccessModifierIndentation #22
Conversation
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutaccessmodifierindentation | ||
Layout/AccessModifierIndentation: | ||
EnforcedStyle: outdent | ||
|
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.
This is a great opportunity to test out the drafted flow, thanks! 🙌🏻
The proposal is to add Severity: info
to restricting changes, allowing some time for teams to adopt new restricting agreements on our style. Some months later, we can remove the Severity: info
thingy to make the change mandatory.
We need to settle things and communicate changes to the teams before moving forward with the PR, but it would be great to have your early feedback on the proposal ❤️
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.
Thanks! Updated :)
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 don't think that we need to make this severity: info, because rubocop checks are performed only on the changed files, so the impact is scoped to the code that you are workin on.
I think we all have allready agreed that we want uniform styling of the code everywhere, so adding yet another rule that slightly changes some of the code's formatting has minimal impact on our workflow.
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.
@valdis not all applications have rubocop configured to run on changed files only, though that is the case for most of them. We want to make sure these style changes are as non-disruptive as possible to everyone, and that's why we proposed to use severity: info
for restricting changes, making them mandatory only after teams have had enough time to update.
Maybe we should consider using non-full scans in all our repositories, though.
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 have a concern.
Right now the rule that wants private methods indented relative to private is not activating, but if you apply the fix for the new rule and indent private
it will:
The changes will not be like
-private
+ private
but like
-private
+ private
- def any_other_method
- here
- end
+ def any_other_method
+ here
+ end
- def below
- here
- end
+ def below
+ here
+ end
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'm not sure I completely follow your scenario, so I've come up with the weirdest indentation and it seems to work for me:
Is this not the case you're concerned about? |
Rules that force code re-formating are anoying, but they annoy us only for a limited time. Thus i don't see this being a problem. |
What is the goal?
To standardise how
private
sections are indented in a classWhile navigating Simba, I found a couple of classes with the
private
section indented (e.g. ServiceItems::ServiceItemStates::HandlerJob) and found that Rubocop did not complain.We've usually used the outdented version
This PR just adds the cop that looks for that outdentation.
Is this a restricting or expanding change?
RESTRICTING change
How is it tested?
Manual tests