Skip to content

Commit 010600d

Browse files
committed
Improve the output of RailsInspect::Cli
Give the developer some direction on how to resolve the error so they don't need to read the code to figure it out.
1 parent 979c6b0 commit 010600d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tools/rail_inspector/lib/rail_inspector/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def configuration(rails_path)
2525
checker = Configuring.new(rails_path)
2626
checker.check
2727

28-
puts checker.errors unless checker.errors.empty?
28+
puts checker.error_message if checker.errors.any?
2929
exit checker.errors.empty? unless options[:autocorrect]
3030

3131
checker.write!

tools/rail_inspector/lib/rail_inspector/configuring.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ def write!
8383
File.write(doc_path, doc.to_s)
8484
end
8585

86+
def error_message
87+
return unless errors.any?
88+
89+
errors.join("\n") + "\n" +
90+
"Make sure new configurations are added to configuring.md#rails-general-configuration in alphabetical order.\n" +
91+
"Errors may be autocorrectable with the --autocorrect flag"
92+
end
93+
8694
private
8795
def doc_path
8896
@rails_path.join(DOC_PATH)

0 commit comments

Comments
 (0)