Skip to content

Commit

Permalink
Protect against pretend generates
Browse files Browse the repository at this point in the history
Amend the Rails configuration tip to protect against pretend generates,
i.e. the `-p` flag.
  • Loading branch information
jherdman committed Mar 28, 2024
1 parent b59d666 commit 6a4d623
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/fix_rails_advice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#1263](https://github.com/rubocop/rubocop-rails/pull/1263): Fixes Rails configuration advice to protect against pretend generates ([@jherdman][])
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ your config/application.rb to apply RuboCop autocorrection to code generated by
module YourCoolApp
class Application < Rails::Application
config.generators.after_generate do |files|
parsable_files = files.filter { |file| file.end_with?('.rb') }
parsable_files = files.filter { |file| File.exist?(file) && file.end_with?('.rb') }
unless parsable_files.empty?
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
end
Expand Down

0 comments on commit 6a4d623

Please sign in to comment.