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
Check and change some of our current rubocop configuration #456
Conversation
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 feel we have to discuss a lot of the changes made in this PR, some make sense to me but the majority don't.
@@ -29,21 +29,11 @@ Layout/LineLength: | |||
- db/**/* | |||
|
|||
Layout/SpaceBeforeFirstArg: | |||
Exclude: | |||
- app/views/api/**/**/* | |||
AllowForAlignment: 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 don't like having aligned comments, would this limit the ability of having multi line comments that are not aligned?
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 this is for comments right? I think it's because in views we do
json.id user.id
json.email user.email
json.name user.full_name
json.username user.username
which I don't like but it is what it is 🤷
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 indeed only for arguments, not comments. Layout::CommentIndentation
would be the one that would modify comments
Style/BlockDelimiters: | ||
EnforcedStyle: braces_for_chaining | ||
Exclude: |
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.
why did we remove this config for specs? Not saying I like the braces_for_chaining
but even the default one is a good config to have.
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.
Lint/BinaryOperatorWithIdenticalOperands: | ||
Enabled: false | ||
|
||
Lint/DeprecatedOpenSSLConstant: | ||
Enabled: false | ||
|
||
Lint/RaiseException: | ||
Enabled: false | ||
|
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 like this rules being enabled 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.
I do too
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.
Nice
@@ -88,11 +75,9 @@ RSpec/MultipleExpectations: | |||
RSpec/NamedSubject: | |||
Enabled: false | |||
|
|||
Style/ArrayCoercion: | |||
Enabled: 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'm 50/50 on this change.
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.
See my note, I removed it mainly because of the issue.
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 okay with removing this
@@ -73,9 +63,6 @@ Metrics/ModuleLength: | |||
Metrics/PerceivedComplexity: | |||
Max: 12 | |||
|
|||
Rails/FilePath: | |||
Enabled: false |
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 would leave this config
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.
btw slashes is the default, not arguments: https://docs.rubocop.org/rubocop-rails/cops_rails.html#enforcedstyle-slashes-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.
You are right. So you would leave it turned off?
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 would leave this disabled as well 😄
Style/HashLikeCase: | ||
MinBranchesCount: 4 | ||
|
||
Style/HashTransformKeys: | ||
Enabled: false |
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.
TIL I learned about transform_keys, but again since it can generate false positives I prefer no to enable it 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.
https://docs.rubocop.org/rubocop/usage/auto_correct.html#safe-auto-correct
maybe we don't need to worry too much about the unsafe cops since we can use a safe autocorrect?
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 can also AutoCorrect: false
so it never happens and it has to be a manual choice
Style/HashTransformKeys: | ||
Enabled: false | ||
|
||
Style/HashTransformValues: |
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.
Same here
Enabled: false | ||
|
||
Style/RedundantFileExtensionInRequire: | ||
Enabled: false |
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.
👍🏻
Enabled: false | ||
|
||
Style/RedundantRegexpCharacterClass: | ||
Enabled: false |
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.
👍🏻
Style/ReturnNil: | ||
Enabled: true | ||
|
||
Style/SlicingWithRange: |
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.
As same as above given the nature of false positives this has I would keep it disabled 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.
I was getting my info from rubydoc.info which did not mention some of these false positives, I see docs.rubocop.org is better documented (as it should)
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.
Nice
Lint/BinaryOperatorWithIdenticalOperands: | ||
Enabled: false | ||
|
||
Lint/DeprecatedOpenSSLConstant: | ||
Enabled: false | ||
|
||
Lint/RaiseException: | ||
Enabled: false | ||
|
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.
Nice
@@ -73,9 +63,6 @@ Metrics/ModuleLength: | |||
Metrics/PerceivedComplexity: | |||
Max: 12 | |||
|
|||
Rails/FilePath: | |||
Enabled: false |
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 would leave this disabled as well 😄
@@ -88,11 +75,9 @@ RSpec/MultipleExpectations: | |||
RSpec/NamedSubject: | |||
Enabled: false | |||
|
|||
Style/ArrayCoercion: | |||
Enabled: 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'm okay with removing this
@@ -103,35 +88,14 @@ Style/ExpandPathArguments: | |||
Style/GlobalStdStream: | |||
Enabled: false | |||
|
|||
Style/HashEachMethods: |
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.
Board:
Notion ticket
Description:
Checking the Rubocop rules we have set specific options to in our .rubocoop.yml
Notes:
List of changes or comments:
AllowForAlignment
so it works ok for how we use it on views.expect { }.to
even if it's multiline..Tasks:
Risk:
Preview: