From 48cd5df14de12ceaae4c2e46276bc9713b804049 Mon Sep 17 00:00:00 2001 From: James Herdman Date: Wed, 27 Mar 2024 21:21:40 -0400 Subject: [PATCH] Protect against pretend generates Amend the Rails configuration tip to protect against pretend generates, i.e. the `-p` flag. --- docs/modules/ROOT/pages/usage.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 7d9f47b47b..1b68c110d4 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -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