Skip to content
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

Rubocop suggestions #392

Merged
merged 4 commits into from
Aug 3, 2023
Merged

Rubocop suggestions #392

merged 4 commits into from
Aug 3, 2023

Conversation

mwolman
Copy link
Contributor

@mwolman mwolman commented Jul 27, 2023

Description:

Some improvements/suggestions to this PR 🤗

@mwolman mwolman self-assigned this Jul 27, 2023
@@ -0,0 +1,33 @@
# This configuration was generated by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of the .rubocop_todo.yml but as I understand it, it's meant for things that want to be fixed at some point (that why the "TODO"). So I wonder, is it our case here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santib that's a good point.

I like the idea as well, but it kinda force us to consider every violation as "tech debt". I think we should all be aligned on this since it will impact the whole company in some way.

IMO: Every violation should be considered as tech debt. If there are no plans to fix it, does the rule make sense? is it useful? Maybe it just needs to be disabled on the main config file.
I can't think of an scenario where we want to keep the offense and still consider that rule useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with what you said. In general terms think there are 2 kinds of exceptions:

  1. Tech debt: things that should be fixed at some point
  2. Directory level: some directories might need different rules, especially when using DSLs like RSpec or ActiveAdmin

For the rails_api_base I think we should only have the second kind of exceptions (which are not intended to be fixed) so projects start with a clean state

db/.rubocop.yml Outdated
@@ -0,0 +1,8 @@
inherit_from:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I'm not really convinced about having multiples .rubocop.yml overriding each other.. I feel like just a centralized place is simpler.. not sure though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this file is in db/, I would move it to the main folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we should move it to the root.

We can customize the root .rubocop.yml file using Include/Exclude to enable some cops only for specific directories

.rubocop.yml Outdated
Comment on lines 27 to 28
Layout/LineLength:
Max: 100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not related to your changes but WDYT about removing this one? The default is 120 chars which makes more sense now with wider screens 🤔

Suggested change
Layout/LineLength:
Max: 100

Comment on lines +38 to +45
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: false

Lint/DeprecatedOpenSSLConstant:
Enabled: false

Lint/RaiseException:
Enabled: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for the future, we should double check these cops. Might be a good idea to turn them on (default)

Copy link
Member

@santib santib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! left some open ended comments

@mwolman mwolman requested a review from TimoPeraza August 3, 2023 18:54
@TimoPeraza TimoPeraza merged commit 76d68f9 into update/rubocop Aug 3, 2023
1 check passed
@TimoPeraza TimoPeraza deleted the rubocop-suggestions branch August 3, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants