Skip to content

Commit

Permalink
Merge pull request #50942 from andrewn617/better-rails-inspector-message
Browse files Browse the repository at this point in the history
Improve the output of RailsInspect::Cli
  • Loading branch information
gmcgibbon committed Feb 1, 2024
2 parents 9d0a913 + 010600d commit 3d887b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/rail_inspector/lib/rail_inspector/cli.rb
Expand Up @@ -25,7 +25,7 @@ def configuration(rails_path)
checker = Configuring.new(rails_path)
checker.check

puts checker.errors unless checker.errors.empty?
puts checker.error_message if checker.errors.any?
exit checker.errors.empty? unless options[:autocorrect]

checker.write!
Expand Down
8 changes: 8 additions & 0 deletions tools/rail_inspector/lib/rail_inspector/configuring.rb
Expand Up @@ -83,6 +83,14 @@ def write!
File.write(doc_path, doc.to_s)
end

def error_message
return unless errors.any?

errors.join("\n") + "\n" +
"Make sure new configurations are added to configuring.md#rails-general-configuration in alphabetical order.\n" +
"Errors may be autocorrectable with the --autocorrect flag"
end

private
def doc_path
@rails_path.join(DOC_PATH)
Expand Down

0 comments on commit 3d887b4

Please sign in to comment.