diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9b7d277981..5030b82a9a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -700,16 +700,6 @@ Rails/SquishedSQLHeredocs: - 'app/queries/outstanding_balance.rb' - 'spec/queries/outstanding_balance_spec.rb' -# Offense count: 24 -# This cop supports safe autocorrection (--autocorrect). -Rails/StripHeredoc: - Exclude: - - 'app/models/content_configuration.rb' - - 'app/queries/customers_with_balance.rb' - - 'app/queries/outstanding_balance.rb' - - 'lib/reporting/reports/enterprise_fee_summary/scope.rb' - - 'lib/tasks/data/truncate_data.rake' - # Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. diff --git a/app/models/content_configuration.rb b/app/models/content_configuration.rb index 2d473db24f..9276e97a4c 100644 --- a/app/models/content_configuration.rb +++ b/app/models/content_configuration.rb @@ -71,7 +71,7 @@ class ContentConfiguration < Spree::Preferences::Configuration preference :footer_pinterest_url, :string, default: "" preference :footer_email, :string, default: "hello@openfoodnetwork.org" preference :community_forum_url, :string, default: "http://community.openfoodnetwork.org" - preference :footer_links_md, :text, default: <<-EOS.strip_heredoc + preference :footer_links_md, :text, default: <<~EOS [Newsletter sign-up](/) [News](/) diff --git a/app/queries/customers_with_balance.rb b/app/queries/customers_with_balance.rb index 553ca88cec..623190ff4c 100644 --- a/app/queries/customers_with_balance.rb +++ b/app/queries/customers_with_balance.rb @@ -20,7 +20,7 @@ class CustomersWithBalance # The resulting orders are in states that belong after the checkout. Only these can be considered # for a customer's balance. def left_join_complete_orders - <<-SQL.strip_heredoc + <<~SQL LEFT JOIN spree_orders ON spree_orders.customer_id = customers.id AND #{finalized_states.to_sql} SQL diff --git a/app/queries/outstanding_balance.rb b/app/queries/outstanding_balance.rb index 5f4b5b921f..637451b25c 100644 --- a/app/queries/outstanding_balance.rb +++ b/app/queries/outstanding_balance.rb @@ -29,7 +29,7 @@ class OutstandingBalance # Arel doesn't support CASE statements until v7.1.0 so we'll have to wait with SQL literals # a little longer. See https://github.com/rails/arel/pull/400 for details. def statement - <<-SQL.strip_heredoc + <<~SQL CASE WHEN "spree_orders"."state" IN #{non_fulfilled_states_group.to_sql} THEN "spree_orders"."payment_total" WHEN "spree_orders"."state" IS NOT NULL THEN "spree_orders"."payment_total" - "spree_orders"."total" ELSE 0 END diff --git a/lib/reporting/reports/enterprise_fee_summary/scope.rb b/lib/reporting/reports/enterprise_fee_summary/scope.rb index 3a57ea027c..7b6ed51425 100644 --- a/lib/reporting/reports/enterprise_fee_summary/scope.rb +++ b/lib/reporting/reports/enterprise_fee_summary/scope.rb @@ -68,7 +68,7 @@ module Reporting def include_adjustment_metadata join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN adjustment_metadata ON (adjustment_metadata.adjustment_id = spree_adjustments.id) JOIN_STRING @@ -81,7 +81,7 @@ module Reporting # * Hub def include_order_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_orders ON ( spree_orders.id = spree_adjustments.order_id @@ -93,7 +93,7 @@ module Reporting join_scope("LEFT OUTER JOIN customers ON (customers.id = spree_orders.customer_id)") join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS hubs ON (hubs.id = spree_orders.distributor_id) JOIN_STRING @@ -106,7 +106,7 @@ module Reporting # * Payment method def include_payment_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_payment_methods ON ( spree_adjustments.originator_type = 'Spree::PaymentMethod' @@ -116,7 +116,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS payment_hubs ON ( spree_payment_methods.id IS NOT NULL @@ -132,7 +132,7 @@ module Reporting # * Shipping method def include_shipping_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_shipping_methods ON ( spree_adjustments.originator_type = 'Spree::ShippingMethod' @@ -148,7 +148,7 @@ module Reporting # * Enterprise fee tax category def include_enterprise_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprise_fees ON ( spree_adjustments.originator_type = 'EnterpriseFee' @@ -158,14 +158,14 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises ON (enterprises.id = enterprise_fees.enterprise_id) JOIN_STRING ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_tax_categories ON (spree_tax_categories.id = enterprise_fees.tax_category_id) JOIN_STRING @@ -179,7 +179,7 @@ module Reporting # * Distributor def include_order_source_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_orders AS adjustment_source_orders ON ( spree_adjustments.adjustable_type = 'Spree::Order' @@ -189,7 +189,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS adjustment_source_distributors ON (adjustment_source_distributors.id = adjustment_source_orders.distributor_id) JOIN_STRING @@ -205,7 +205,7 @@ module Reporting # * Tax category of product, if enterprise fee tells to inherit def include_line_item_source_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_line_items ON ( spree_adjustments.adjustable_type = 'Spree::LineItem' @@ -215,7 +215,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_variants ON ( spree_adjustments.adjustable_type = 'Spree::LineItem' @@ -225,14 +225,14 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_products ON (spree_products.id = spree_variants.product_id) JOIN_STRING ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_tax_categories AS product_tax_categories ON ( enterprise_fees.inherits_tax_category IS TRUE @@ -250,7 +250,7 @@ module Reporting # * Incoming exchange variant def include_incoming_exchange_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN ( exchange_variants AS incoming_exchange_variants @@ -271,7 +271,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS incoming_exchange_enterprises ON (incoming_exchange_enterprises.id = incoming_exchanges.sender_id) JOIN_STRING @@ -286,7 +286,7 @@ module Reporting # * Outgoing exchange variant def include_outgoing_exchange_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN ( exchange_variants AS outgoing_exchange_variants @@ -307,7 +307,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS outgoing_exchange_enterprises ON (outgoing_exchange_enterprises.id = outgoing_exchanges.receiver_id) JOIN_STRING @@ -366,7 +366,7 @@ module Reporting def select_attributes chain_to_scope do select( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING SUM(spree_adjustments.amount) AS total_amount, spree_payment_methods.name AS payment_method_name, spree_shipping_methods.name AS shipping_method_name, diff --git a/lib/tasks/data/truncate_data.rake b/lib/tasks/data/truncate_data.rake index 65075a3ffb..b422d04980 100644 --- a/lib/tasks/data/truncate_data.rake +++ b/lib/tasks/data/truncate_data.rake @@ -32,11 +32,11 @@ namespace :ofn do end def warn_with_confirmation - message = <<-MSG.strip_heredoc - \n - <% highlighted_message = "This will permanently change DB contents. This is not meant to be run in production as it needs more thorough testing." %> - <%= color(highlighted_message, :blink, :on_red) %> - Are you sure you want to proceed? (y/N) + message = <<~MSG + \n + <% highlighted_message = "This will permanently change DB contents. This is not meant to be run in production as it needs more thorough testing." %> + <%= color(highlighted_message, :blink, :on_red) %> + Are you sure you want to proceed? (y/N) MSG exit unless HighLine.new.agree(message) { |question| question.default = "N" }