-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
[Doc] Add config.generators.after_generate
Rails config to docs
#956
Conversation
README.md
Outdated
module YourCoolApp | ||
class Application < Rails::Application | ||
config.generators.after_generate do |files| | ||
system('bundle exec rubocop -A ' + files.join(' '), exception: 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.
Would -a
have a different result for this?
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.
It shows -A
intentionally. I've added that intent to the documentation.
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.
Should this be files.shelljoin
instead? What if some homebrew generator spits out filenames with spaces or escape sequences?
Passing raw strings to system
is scary. 😨
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.
Good cath! shelljoin
would be a better choice.
1b30576
to
e55e26a
Compare
This PR adds a Rails feature introduced by rails/rails#38870 to docs.
e55e26a
to
ca6f2fe
Compare
Without this, the generator would exit with an error, if it found any warning or less severe offenses. Related to rubocop#956
Files not supported by rubocop would lead to an error, which in turn would mean that the rails generate command would fail. We are going to filter the files to ensure unsupported files are not sent to rubocop Followup for rubocop#961 and rubocop#956
Files not supported by rubocop would lead to an error, which in turn would mean that the rails generate command would fail. We are going to filter the files to ensure unsupported files are not sent to rubocop Follow-up for rubocop#961 and rubocop#956
Previously, the 'rails generate' command would send unsupported files to Rubocop,causing errors and failures in the process. To fix this, we added a filter that only sends parsable files to Rubocop. This commit updates the documentation to reflect this change, helping users avoid errors and complete 'rails generate' command successfully. Follow-up to rubocop#961 and rubocop#956
Previously, the 'rails generate' command would send unsupported files to Rubocop, causing errors and failures in the process. To fix this, we added a filter that only sends parsable files to Rubocop. This commit updates the documentation to reflect this change, helping users avoid errors and complete 'rails generate' command successfully. Follow-up to rubocop#961 and rubocop#956
This PR adds a Rails feature introduced by rails/rails#38870 to docs.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.