-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Apply autocorrection by RuboCop to files generated by bin/rails generate
#50506
Merged
dhh
merged 5 commits into
rails:main
from
koic:add_after_generate_to_development_template
Jan 1, 2024
Merged
Apply autocorrection by RuboCop to files generated by bin/rails generate
#50506
dhh
merged 5 commits into
rails:main
from
koic:add_after_generate_to_development_template
Jan 1, 2024
Conversation
This file contains 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
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.
koic
force-pushed
the
add_after_generate_to_development_template
branch
from
December 31, 2023 18:36
85c1ca9
to
5409a89
Compare
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
4 tasks
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 generate
andbin/rubocop
are 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]