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 #4882] Use IndentationWidth
of Layout/Tab
for other cops
#5785
[Fix #4882] Use IndentationWidth
of Layout/Tab
for other cops
#5785
Conversation
I agree with the overall spirit of the change, but I wonder if this is the best way to share the common config between the few cops. Many we can pull up some config values under |
Why don't you like |
Because from a user perspective I find it extremely odd that one cop would be configuring the behavior of a few others. That's never exactly transparent, and it's often quite confusing. We have such dependencies in the code even now, but it's usually for cops where the dependencies between they are quite obvious - I'd normally never go looking for a base indentation width setting in some cop converting tabs into spaces. |
Hmm, I didn't read the ticket before commenting - seeing it I'm even more puzzled. :D I guess you want to teach other cops what to do when tabs are present and this cop for tabs vs spaces is disabled, right? Do you plan to mix tabs and spaces? |
Yes. I thought about: Layout/Indentaiton:
EnforcedStyle: spaces # or 'tabs'
Width: 2 # or Size: But I think
No. Only for alignment: →if foo &&
→...bar
→→job
→end |
9828d7d
to
b3fb97d
Compare
IndentationWidth
of Layout/Tab
for other copsIndentationWidth
of Layout/Tab
for other cops
b3fb97d
to
439d2a5
Compare
Got it. I'm on the fence about this. @jonas054 What do you think? |
👍 I think the change is good. We can assume that most people use only spaces for indentation and alignment, so it won't cause any problems for them. And the change does provide some rudimentary support in RuboCop for people who like the Smart Tabs idea (tabs for indentation and spaces for alignment). Down the road, we might like to add |
That's a great idea! |
@AlexWayfer The documentation of the affected cops has to be updated to mention the new behaviour and the changelog has to be moved to the current release. |
439d2a5
to
1932231
Compare
Done.
I didn't find any information about docs changing in the |
@AlexWayfer It's not mentioned in There are currently failures in the build, BTW. |
1932231
to
1db9860
Compare
Thank you!
That's strange. OK, I fixed. Wat? |
Oh, I found #5966. |
@AlexWayfer I opened a PR #6003 to fix for |
Thank you, I'll wait merging for rebase. |
* Metrics/LineLength * Style/IfUnlessModifier
1db9860
to
f8d8c12
Compare
I was on vacation, now I've rebased this branch and tests passed. (thanks, @koic) |
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.