From fcfe286c09fa084706c3542e5def29218215ad62 Mon Sep 17 00:00:00 2001 From: Tobias Ludwig Maier Date: Wed, 5 Apr 2023 19:03:53 +0200 Subject: [PATCH] Update documentation to fix Rubocop errors in 'rails generate' command 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 #961 and #956 --- README.md | 3 ++- docs/modules/ROOT/pages/usage.adoc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f368997f5f..bc994d7cf6 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,8 @@ your config/application.rb to apply RuboCop autocorrection to code generated by module YourCoolApp class Application < Rails::Application config.generators.after_generate do |files| - system("bundle exec rubocop -A --fail-level=E #{files.shelljoin}", exception: true) + parsable_files = files.filter { |file| file.end_with?('.rb') } + system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true) end end end diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index beda1a7ebc..c2bff0e9f4 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -41,7 +41,8 @@ your config/application.rb to apply RuboCop autocorretion to code generated by ` module YourCoolApp class Application < Rails::Application config.generators.after_generate do |files| - system("bundle exec rubocop -A --fail-level=E #{files.shelljoin}", exception: true) + parsable_files = files.filter { |file| file.end_with?('.rb') } + system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true) end end end