From 09dd5c00c49868fdd0ca2dd86350a076cf27e185 Mon Sep 17 00:00:00 2001 From: Morgan Aubert Date: Sat, 7 Dec 2024 07:25:28 -0400 Subject: [PATCH] Address ameba warnings --- src/marten.cr | 4 ++-- src/marten/db/query/sql/predicate_node.cr | 5 +++-- src/marten/server/handlers/logger.cr | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/marten.cr b/src/marten.cr index 9459f6190..28ff09e62 100644 --- a/src/marten.cr +++ b/src/marten.cr @@ -312,13 +312,13 @@ module Marten base_message = "Marten running on #{Marten::Server.addresses.join ", "} (Press CTRL+C to quit)" if Marten.settings.debug? - Log.info { + Log.info do String.build do |s| s << "#{"=" * base_message.size}\n" s << base_message s << "\n#{"=" * base_message.size}" end - } + end else Log.info { base_message } end diff --git a/src/marten/db/query/sql/predicate_node.cr b/src/marten/db/query/sql/predicate_node.cr index ef48d4341..57e29e19e 100644 --- a/src/marten/db/query/sql/predicate_node.cr +++ b/src/marten/db/query/sql/predicate_node.cr @@ -92,10 +92,11 @@ module Marten def replace_table_alias_prefix(old_vs_new_table_aliases : Hash(String, String)) : Nil return unless filter_predicates? - filter_predicates.each { |p| + filter_predicates.each do |p| next unless old_vs_new_table_aliases.has_key?(p.alias_prefix) p.alias_prefix = old_vs_new_table_aliases[p.alias_prefix] - } + end + @children.each { |c| c.replace_table_alias_prefix(old_vs_new_table_aliases) } end diff --git a/src/marten/server/handlers/logger.cr b/src/marten/server/handlers/logger.cr index c53683025..1dcd4a516 100644 --- a/src/marten/server/handlers/logger.cr +++ b/src/marten/server/handlers/logger.cr @@ -6,10 +6,10 @@ module Marten def call(context : ::HTTP::Server::Context) duration = Time.measure { call_next(context) } - Log.info { + Log.info do "\"#{context.request.method} #{context.request.path}\" " \ "#{context.response.status_code} - #{duration.total_milliseconds}ms" - } + end end end end