Apply autocorrection by RuboCop to files generated by bin/rails generate#50506
Merged
dhh merged 5 commits intorails:mainfrom Jan 1, 2024
Merged
Apply autocorrection by RuboCop to files generated by bin/rails generate#50506dhh merged 5 commits intorails:mainfrom
bin/rails generate#50506dhh merged 5 commits intorails:mainfrom
Conversation
Member
|
Love the concept, but would like if we could package up the code needed to accomplish this. There's a little too much logic code to have in the config file. |
…rate` ## Motivation / Background RuboCop has now been included by default (rails#50456). By adding the following tip to the default configuration, user can apply RuboCop's autocorrection to code generated by `bin/rails generate` (e.g., migration file): https://github.com/rubocop/rubocop-rails#rails-configuration-tip This means that the generated files will be formatted according to user's .rubocop.yml custom configuration. ## Detail Since `bin/rails generate` and `bin/rubocop` are used only in the development environment, the target files are limited to only `config/environments/development.rb`. ## Additional information This feature was introduced in Rails 6.1 by rails#38870.
85c1ca9 to
5409a89
Compare
Contributor
Author
|
Sure! I have packaged it as |
zzak
reviewed
Jan 1, 2024
railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
Outdated
Show resolved
Hide resolved
dhh
reviewed
Jan 1, 2024
* main: Add brakeman as development dependency Fix skipped rubocop test typo (rails#50519) Update the puma startup message docs: remove unneeded whitespace from start of code blocks Add changelog entry for rails#50512 Add step to keep screenshots of failed system tests Fix name casing ✂️ cut trailing whitespace Switch to headless chrome by default (rails#50512) Fix generator output paths New default files Errant debug puts Add changelog entry for rails#50505 [ci skip] (rails#50513) Default to creating GitHub CI files (rails#50508) Remove unnecessary require Fix railspect not validating alphabetical order
4 tasks
dhh
added a commit
to skipkayhil/rails
that referenced
this pull request
Jan 2, 2024
* main: Add a default yield :head to layouts/application.html.erb (rails#50527) Switch to new enum syntax in example code [ci-skip] Utilize new enum syntax Apply autocorrection by RuboCop to files generated by `bin/rails generate` (rails#50506) Add brakeman as development dependency Fix skipped rubocop test typo (rails#50519) Update the puma startup message docs: remove unneeded whitespace from start of code blocks Add changelog entry for rails#50512 Remove unnecessary require Fix railspect not validating alphabetical order
Contributor
Contributor
Contributor
|
I made a PR here #53138 |
yoones
pushed a commit
to yoones/rails
that referenced
this pull request
Mar 6, 2025
…rate` (rails#50506) * Apply autocorrection by RuboCop to files generated by `bin/rails generate` ## Motivation / Background RuboCop has now been included by default (rails#50456). By adding the following tip to the default configuration, user can apply RuboCop's autocorrection to code generated by `bin/rails generate` (e.g., migration file): https://github.com/rubocop/rubocop-rails#rails-configuration-tip This means that the generated files will be formatted according to user's .rubocop.yml custom configuration. ## Detail Since `bin/rails generate` and `bin/rubocop` are used only in the development environment, the target files are limited to only `config/environments/development.rb`. ## Additional information This feature was introduced in Rails 6.1 by rails#38870.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / Background
RuboCop has now been included by default (#50456). By adding the following tip to the default configuration, user can apply RuboCop's autocorrection to code generated by
bin/rails generate(e.g., migration file):https://github.com/rubocop/rubocop-rails#rails-configuration-tip
This means that the generated files will be formatted according to user's .rubocop.yml custom configuration.
Detail
Since
bin/rails generateandbin/rubocopare used only in the development environment, the target files are limited to onlyconfig/environments/development.rb.Additional information
This feature was introduced in Rails 6.1 by #38870.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]