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

Enable autocorrection for Style/ClassAndModuleChildren #8595

Merged
merged 3 commits into from Sep 1, 2020

Conversation

marcandre
Copy link
Contributor

We have 3 cops remaining with AutoCorrect: false:

  • Layout/LineLength: probably too crude to be enabled by default
  • Security/JSONLoad: too crude too, and quite minor
  • Style/ClassAndModuleChildren: correctly marked as unsafe auto-correction, I think it should be enabled by default, hence this PR.

Follows #8594

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 26, 2020

Layout/LineLength: probably too crude to be enabled by default

On the other hand - I have it on good authority many people don't even know this auto-correction exists and dream of it. I'd vote to enable it. Maybe this will force us to improve it. :-)

@marcandre
Copy link
Contributor Author

Layout/LineLength: probably too crude to be enabled by default

On the other hand - I have it on good authority many people don't even know this auto-correction exists and dream of it. I'd vote to enable it. Maybe this will force us to improve it. :-)

LineLength is definitely the offense that I raise the most in my code, and I almost never want it to be fixed automatically; I typically will extract some sub-expression and store it in a local and no improved autocorrector could do that (and name the variable properly). The only auto-correction I wouldn't mind happening is an inline block being expanded to a multi line one.

Is there a way to have a .rubocop.local.yml for local overrides (for RuboCop)? We'd need a inherit_from_if_exist that doesn't raises if the config doesn't exist? This way I wouldn't be impacted; otherwise I will probably be forced to use -a instead of -A

@bbatsov bbatsov merged commit eb04490 into rubocop:master Sep 1, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Sep 1, 2020

LineLength is definitely the offense that I raise the most in my code, and I almost never want it to be fixed automatically; I typically will extract some sub-expression and store it in a local and no improved autocorrector could do that (and name the variable properly). The only auto-correction I wouldn't mind happening is an inline block being expanded to a multi line one.

I understand this perspective, but on the other hand without reflowing long lines automatically you can't really use RuboCop as a formatter.

Is there a way to have a .rubocop.local.yml for local overrides (for RuboCop)? We'd need a inherit_from_if_exist that doesn't raises if the config doesn't exist? This way I wouldn't be impacted; otherwise I will probably be forced to use -a instead of -A

What would be the purpose of this local config? Overriding project settings or user settings?

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.

None yet

2 participants