Skip to content

Commit 48d6285

Browse files
authored
Merge pull request rails#51808 from koic/suppress_rubocop_output_when_code_generation
Suppress RuboCop output when there are no offenses in code generation
2 parents d2cf718 + 6afc368 commit 48d6285

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

railties/lib/rails/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def apply_rubocop_autocorrect_after_generate!
135135
after_generate do |files|
136136
parsable_files = files.filter { |file| File.exist?(file) && file.end_with?(".rb") }
137137
unless parsable_files.empty?
138-
system(RbConfig.ruby, "bin/rubocop", "-A", "--fail-level=E", *parsable_files, exception: true)
138+
system(RbConfig.ruby, "bin/rubocop", "-A", "--fail-level=E", "--format=quiet", *parsable_files, exception: true)
139139
end
140140
end
141141
end

railties/test/application/generators_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def check_expected
263263
end
264264

265265
output = rails("generate", "model", "post", "title:string", "body:string")
266-
assert_match(/3 files inspected, no offenses detected/, output)
266+
assert_no_match(/3 files inspected, no offenses detected/, output)
267267
end
268268

269269
test "generators with apply_rubocop_autocorrect_after_generate! and pretend" do

0 commit comments

Comments
 (0)