From 04a34831c74a3a44547f93100c35db650bc4eef6 Mon Sep 17 00:00:00 2001 From: Adam Cooke Date: Sat, 10 Feb 2024 23:08:04 +0000 Subject: [PATCH] style(rubocop): Style/For --- app/helpers/application_helper.rb | 10 +++++----- app/jobs/unqueue_message_job.rb | 2 +- lib/postal/message_db/database.rb | 2 +- lib/postal/user_creator.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c87fd7d1..0e54e0db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,7 +30,7 @@ def domain_options_for_select(server, selected_domain = nil, options = {}) server_domains = server.domains.verified.order(:name) unless server_domains.empty? s << "" - for domain in server_domains + server_domains.each do |domain| selected = domain == selected_domain ? "selected='selected'" : "" s << "" end @@ -40,7 +40,7 @@ def domain_options_for_select(server, selected_domain = nil, options = {}) organization_domains = server.organization.domains.verified.order(:name) unless organization_domains.empty? s << "" - for domain in organization_domains + organization_domains.each do |domain| selected = domain == selected_domain ? "selected='selected'" : "" s << "" end @@ -56,7 +56,7 @@ def endpoint_options_for_select(server, selected_value = nil, options = {}) http_endpoints = server.http_endpoints.order(:name).to_a if http_endpoints.present? s << "" - for endpoint in http_endpoints + http_endpoints.each do |endpoint| value = "#{endpoint.class}##{endpoint.uuid}" selected = value == selected_value ? "selected='selected'" : "" s << "" @@ -67,7 +67,7 @@ def endpoint_options_for_select(server, selected_value = nil, options = {}) smtp_endpoints = server.smtp_endpoints.order(:name).to_a if smtp_endpoints.present? s << "" - for endpoint in smtp_endpoints + smtp_endpoints.each do |endpoint| value = "#{endpoint.class}##{endpoint.uuid}" selected = value == selected_value ? "selected='selected'" : "" s << "" @@ -78,7 +78,7 @@ def endpoint_options_for_select(server, selected_value = nil, options = {}) address_endpoints = server.address_endpoints.order(:address).to_a if address_endpoints.present? s << "" - for endpoint in address_endpoints + address_endpoints.each do |endpoint| value = "#{endpoint.class}##{endpoint.uuid}" selected = value == selected_value ? "selected='selected'" : "" s << "" diff --git a/app/jobs/unqueue_message_job.rb b/app/jobs/unqueue_message_job.rb index 3ba4a7d2..d2d8619b 100644 --- a/app/jobs/unqueue_message_job.rb +++ b/app/jobs/unqueue_message_job.rb @@ -94,7 +94,7 @@ def perform log "#{log_prefix} Message is a bounce" original_messages = queued_message.message.original_messages unless original_messages.empty? - for original_message in queued_message.message.original_messages + queued_message.message.original_messages.each do |original_message| queued_message.message.update(bounce_for_id: original_message.id, domain_id: original_message.domain_id) queued_message.message.create_delivery("Processed", details: "This has been detected as a bounce message for .") original_message.bounce!(queued_message.message) diff --git a/lib/postal/message_db/database.rb b/lib/postal/message_db/database.rb index a968993a..a18f6379 100644 --- a/lib/postal/message_db/database.rb +++ b/lib/postal/message_db/database.rb @@ -333,7 +333,7 @@ def query_on_connection(connection, query) id = Nifty::Utils::RandomString.generate(length: 6).upcase explain_result = ResultForExplainPrinter.new(connection.query("EXPLAIN #{query}")) slow_query_logger.info "[#{id}] EXPLAIN #{query}" - for line in ActiveRecord::ConnectionAdapters::MySQL::ExplainPrettyPrinter.new.pp(explain_result, time).split("\n") + ActiveRecord::ConnectionAdapters::MySQL::ExplainPrettyPrinter.new.pp(explain_result, time).split("\n").each do |line| slow_query_logger.info "[#{id}] " + line end end diff --git a/lib/postal/user_creator.rb b/lib/postal/user_creator.rb index 502da82e..27bb973a 100644 --- a/lib/postal/user_creator.rb +++ b/lib/postal/user_creator.rb @@ -23,7 +23,7 @@ def self.start(&block) puts "User has been created with e-mail address \e[32m#{user.email_address}\e[0m" else puts "\e[31mFailed to create user\e[0m" - for error in user.errors.full_messages + user.errors.full_messages.each do |error| puts " * #{error}" end end