Skip to content

Commit e78e8af

Browse files
authored
Merge pull request #1123 from sinsoku/update-rails-tips
[Doc] Prevent unintended auto-correct with after_generate
2 parents a3711eb + 3691414 commit e78e8af

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ module YourCoolApp
7272
class Application < Rails::Application
7373
config.generators.after_generate do |files|
7474
parsable_files = files.filter { |file| file.end_with?('.rb') }
75-
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
75+
unless parsable_files.empty?
76+
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
77+
end
7678
end
7779
end
7880
end

docs/modules/ROOT/pages/usage.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ module YourCoolApp
4242
class Application < Rails::Application
4343
config.generators.after_generate do |files|
4444
parsable_files = files.filter { |file| file.end_with?('.rb') }
45-
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
45+
unless parsable_files.empty?
46+
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
47+
end
4648
end
4749
end
4850
end

0 commit comments

Comments
 (0)