From 422965748f841f312c7fce412d0c76c9e163017b Mon Sep 17 00:00:00 2001 From: zanetagebka Date: Mon, 17 Jun 2024 15:32:25 +0200 Subject: [PATCH] Solve Rubocop RedundantInterpolation cops --- .rubocop_todo.yml | 60 +++++++++++++++------------------------- lib/tasks/karma.rake | 2 +- spec/base_spec_helper.rb | 2 +- 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8a6981e6b8..8fce4f930f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,20 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp` -# using RuboCop version 1.62.1. +# using RuboCop version 1.63.5. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'tmp/stimulus_reflex_installer/working/development.rb' + # Offense count: 16 # Configuration parameters: AllowComments, AllowEmptyLambdas. Lint/EmptyBlock: @@ -22,11 +31,10 @@ Lint/EmptyBlock: - 'spec/jobs/subscription_placement_job_spec.rb' - 'spec/models/product_import/entry_validator_spec.rb' -# Offense count: 6 +# Offense count: 4 # Configuration parameters: AllowComments. Lint/EmptyClass: Exclude: - - 'spec/controllers/spree/admin/base_controller_spec.rb' - 'spec/lib/reports/report_loader_spec.rb' # Offense count: 1 @@ -80,7 +88,7 @@ Lint/UselessMethodDefinition: Exclude: - 'app/models/spree/gateway.rb' -# Offense count: 26 +# Offense count: 24 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max. Metrics/AbcSize: Exclude: @@ -102,7 +110,6 @@ Metrics/AbcSize: - 'lib/open_food_network/order_cycle_form_applicator.rb' - 'lib/open_food_network/order_cycle_permissions.rb' - 'lib/spree/core/controller_helpers/order.rb' - - 'lib/tasks/enterprises.rake' - 'spec/services/orders/checkout_restart_service_spec.rb' # Offense count: 9 @@ -123,7 +130,7 @@ Metrics/BlockNesting: Exclude: - 'app/models/spree/payment/processing.rb' -# Offense count: 46 +# Offense count: 47 # Configuration parameters: CountComments, Max, CountAsOne. Metrics/ClassLength: Exclude: @@ -175,7 +182,7 @@ Metrics/ClassLength: - 'lib/reporting/reports/enterprise_fee_summary/scope.rb' - 'lib/reporting/reports/xero_invoices/base.rb' -# Offense count: 34 +# Offense count: 32 # Configuration parameters: AllowedMethods, AllowedPatterns, Max. Metrics/CyclomaticComplexity: Exclude: @@ -185,7 +192,6 @@ Metrics/CyclomaticComplexity: - 'app/helpers/checkout_helper.rb' - 'app/helpers/order_cycles_helper.rb' - 'app/helpers/spree/admin/navigation_helper.rb' - - 'app/models/enterprise.rb' - 'app/models/enterprise_relationship.rb' - 'app/models/product_import/entry_validator.rb' - 'app/models/spree/ability.rb' @@ -206,7 +212,7 @@ Metrics/CyclomaticComplexity: - 'lib/spree/localized_number.rb' - 'spec/models/product_importer_spec.rb' -# Offense count: 25 +# Offense count: 24 # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Exclude: @@ -391,7 +397,6 @@ RSpecRails/HaveHttpStatus: - 'spec/controllers/user_registrations_controller_spec.rb' - 'spec/requests/admin/images_spec.rb' - 'spec/requests/api/routes_spec.rb' - - 'spec/requests/checkout/failed_checkout_spec.rb' - 'spec/requests/checkout/stripe_sca_spec.rb' - 'spec/requests/home_controller_spec.rb' - 'spec/requests/omniauth_callbacks_controller_spec.rb' @@ -407,7 +412,7 @@ RSpecRails/HttpStatus: - 'spec/controllers/spree/admin/products_controller_spec.rb' - 'spec/requests/api/orders_spec.rb' -# Offense count: 146 +# Offense count: 144 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Inferences. RSpecRails/InferredSpecType: @@ -511,7 +516,6 @@ RSpecRails/InferredSpecType: - 'spec/helpers/navigation_helper_spec.rb' - 'spec/helpers/order_cycles_helper_spec.rb' - 'spec/helpers/serializer_helper_spec.rb' - - 'spec/helpers/shared_helper_spec.rb' - 'spec/helpers/shop_helper_spec.rb' - 'spec/helpers/spree/admin/base_helper_spec.rb' - 'spec/helpers/spree/admin/general_settings_helper_spec.rb' @@ -545,7 +549,6 @@ RSpecRails/InferredSpecType: - 'spec/requests/api/routes_spec.rb' - 'spec/requests/api/v1/customers_spec.rb' - 'spec/requests/api_docs_spec.rb' - - 'spec/requests/checkout/failed_checkout_spec.rb' - 'spec/requests/checkout/paypal_spec.rb' - 'spec/requests/checkout/routes_spec.rb' - 'spec/requests/checkout/stripe_sca_spec.rb' @@ -642,7 +645,7 @@ Rails/RedundantActiveRecordAllMethod: - 'app/models/spree/variant.rb' - 'spec/system/admin/product_import_spec.rb' -# Offense count: 4 +# Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/RedundantPresenceValidationOnBelongsTo: Exclude: @@ -765,7 +768,7 @@ Style/CaseEquality: Exclude: - 'spec/models/spree/payment_spec.rb' -# Offense count: 25 +# Offense count: 23 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: nested, compact @@ -792,16 +795,16 @@ Style/ClassAndModuleChildren: - 'app/serializers/api/taxon_serializer.rb' - 'app/serializers/api/variant_serializer.rb' - 'lib/open_food_network/locking.rb' - - 'spec/controllers/spree/admin/base_controller_spec.rb' - 'spec/models/spree/payment_method_spec.rb' -# Offense count: 1 +# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Exclude: - '.simplecov' + - 'tmp/stimulus_reflex_installer/working/development.rb' # Offense count: 6 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -845,12 +848,6 @@ Style/HashEachMethods: - 'spec/models/product_importer_spec.rb' - 'spec/support/cancan_helper.rb' -# Offense count: 1 -# Configuration parameters: MinBranchesCount. -Style/HashLikeCase: - Exclude: - - 'app/models/enterprise.rb' - # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). Style/MapToHash: @@ -939,19 +936,6 @@ Style/RedundantInitialize: Exclude: - 'spec/models/spree/gateway_spec.rb' -# Offense count: 2 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/RedundantInterpolation: - Exclude: - - 'lib/tasks/karma.rake' - - 'spec/base_spec_helper.rb' - -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantLineContinuation: - Exclude: - - 'lib/reporting/reports/enterprise_fee_summary/scope.rb' - # Offense count: 19 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -994,7 +978,7 @@ Style/Send: - 'spec/services/variant_units/option_value_namer_spec.rb' - 'spec/support/localized_number_helper.rb' -# Offense count: 4 +# Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SlicingWithRange: Exclude: @@ -1002,7 +986,7 @@ Style/SlicingWithRange: - 'app/services/embedded_page_service.rb' - 'engines/order_management/app/services/order_management/subscriptions/validator.rb' -# Offense count: 25 +# Offense count: 23 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: diff --git a/lib/tasks/karma.rake b/lib/tasks/karma.rake index 3ee505f731..0c2183c6e9 100644 --- a/lib/tasks/karma.rake +++ b/lib/tasks/karma.rake @@ -39,6 +39,6 @@ namespace :karma do I18n::JS::DEFAULT_EXPORT_DIR_PATH.replace('tmp/javascripts') I18n::JS.export - "#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH, 'translations.js')}" + Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH, 'translations.js').to_s end end diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index fcb68b76d6..8a6e29a22e 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -60,7 +60,7 @@ InvisibleCaptcha.timestamp_enabled = false RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{Rails.root.join('spec/fixtures')}" + config.fixture_path = Rails.root.join('spec/fixtures').to_s # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false