From 78338864d84c3821261cd494cf08d09aa40bfd1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 09:57:30 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump rubocop from 1.51.0 to 1.52.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.51.0 to 1.52.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.51.0...v1.52.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9c8d236d4c..1c7a7cf2e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -629,7 +629,7 @@ GEM rswag-ui (2.9.0) actionpack (>= 3.1, < 7.1) railties (>= 3.1, < 7.1) - rubocop (1.51.0) + rubocop (1.52.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) @@ -639,7 +639,7 @@ GEM rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.1) + rubocop-ast (1.29.0) parser (>= 3.2.1.0) rubocop-rails (2.19.1) activesupport (>= 4.2.0) From 38bd31d0e3c65f92f1f7682ddaee8d9536c05b88 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 5 Jun 2023 10:41:53 +1000 Subject: [PATCH 2/4] Style Layout/TrailingWhitespace --- spec/system/consumer/split_checkout_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index 269551b7ff..59e428f2de 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -761,7 +761,7 @@ describe "As a consumer, I want to checkout my order" do expect(page).to have_content( "Note: if your order total is less than your voucher " \ - "you may not be able to spend the remaining value." + "you may not be able to spend the remaining value." ) end end From 1cbb45a6184d7930d359086d1aa628d6139f348e Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 5 Jun 2023 10:58:07 +1000 Subject: [PATCH 3/4] Style Lint/RedundantSafeNavigation The cop suggested to change more but they were false positives: * https://github.com/rubocop/rubocop/pull/11915 --- app/models/product_import/entry_validator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/product_import/entry_validator.rb b/app/models/product_import/entry_validator.rb index 982c833441..4226caa199 100644 --- a/app/models/product_import/entry_validator.rb +++ b/app/models/product_import/entry_validator.rb @@ -167,7 +167,7 @@ module ProductImport def unit_fields_validation(entry) unit_types = ['g', 'oz', 'lb', 'kg', 't', 'ml', 'l', 'kl', ''] - unless entry.units&.present? + if entry.units.blank? mark_as_invalid(entry, attribute: 'units', error: I18n.t('admin.product_import.model.blank')) end @@ -180,7 +180,7 @@ module ProductImport return if import_into_inventory? # unit_type must be valid type - if entry.unit_type&.present? + if entry.unit_type.present? unit_type = entry.unit_type.to_s.strip.downcase unless unit_types.include?(unit_type) mark_as_invalid(entry, attribute: 'unit_type', @@ -190,7 +190,7 @@ module ProductImport end # variant_unit_name must be present if unit_type not present - return if entry.variant_unit_name&.present? + return if entry.variant_unit_name.present? mark_as_invalid(entry, attribute: 'variant_unit_name', error: I18n.t('admin.product_import.model.conditional_blank')) From 16fba20686f5ed4b5c73813a5c1d037c3880a410 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 5 Jun 2023 12:13:35 +1000 Subject: [PATCH 4/4] Update rubocop todo file --- .rubocop_todo.yml | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b0b1d1447c..f0f9944457 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp` -# using RuboCop version 1.51.0. +# using RuboCop version 1.52.0. # 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 @@ -16,7 +16,7 @@ Gemspec/RequiredRubyVersion: - 'engines/order_management/order_management.gemspec' - 'engines/web/web.gemspec' -# Offense count: 28 +# Offense count: 31 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: with_first_argument, with_fixed_indentation @@ -62,11 +62,10 @@ Layout/BlockEndNewline: - 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb' - 'spec/system/admin/orders_spec.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Layout/ClosingParenthesisIndentation: Exclude: - - 'lib/reporting/queries/joins.rb' - 'spec/system/admin/orders_spec.rb' # Offense count: 1 @@ -141,7 +140,7 @@ Layout/LeadingCommentSpace: Exclude: - 'spec/system/admin/enterprises_spec.rb' -# Offense count: 115 +# Offense count: 114 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: space, no_space @@ -198,7 +197,7 @@ Layout/LineEndStringConcatenationIndentation: - 'spec/system/consumer/cookies_spec.rb' - 'spec/system/consumer/shopping/cart_spec.rb' -# Offense count: 643 +# Offense count: 637 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https @@ -376,13 +375,12 @@ Layout/MultilineBlockLayout: Exclude: - 'engines/order_management/app/services/order_management/subscriptions/validator.rb' -# Offense count: 7 +# Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: symmetrical, new_line, same_line Layout/MultilineMethodCallBraceLayout: Exclude: - - 'lib/reporting/queries/joins.rb' - 'spec/system/admin/orders_spec.rb' - 'spec/system/admin/products_spec.rb' @@ -414,7 +412,7 @@ Layout/TrailingEmptyLines: Exclude: - 'Rakefile' -# Offense count: 73 +# Offense count: 76 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowInHeredoc. Layout/TrailingWhitespace: @@ -550,13 +548,17 @@ Lint/RedundantDirGlobSort: - 'spec/base_spec_helper.rb' - 'spec/system_helper.rb' -# Offense count: 1 +# Offense count: 6 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedMethods. # AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? Lint/RedundantSafeNavigation: Exclude: + - 'app/models/report_blob.rb' - 'app/models/spree/payment.rb' + - 'app/serializers/api/admin/subscription_line_item_serializer.rb' + - 'lib/open_food_network/address_finder.rb' + - 'lib/tasks/missing_payments.rake' # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). @@ -900,7 +902,7 @@ Rails/ActionOrder: - 'app/controllers/spree/admin/variants_controller.rb' - 'app/controllers/user_confirmations_controller.rb' -# Offense count: 15 +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -910,7 +912,6 @@ Rails/ActiveRecordCallbacksOrder: - 'app/models/enterprise.rb' - 'app/models/enterprise_group.rb' - 'app/models/enterprise_relationship.rb' - - 'app/models/spree/line_item.rb' - 'app/models/spree/order.rb' - 'app/models/spree/payment.rb' - 'app/models/spree/product.rb' @@ -991,7 +992,7 @@ Rails/FilePath: - 'spec/models/content_configuration_spec.rb' - 'spec/support/downloads_helper.rb' -# Offense count: 11 +# Offense count: 8 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasAndBelongsToMany: @@ -999,12 +1000,9 @@ Rails/HasAndBelongsToMany: - 'app/models/enterprise.rb' - 'app/models/enterprise_group.rb' - 'app/models/order_cycle.rb' - - 'app/models/spree/line_item.rb' - - 'app/models/spree/option_value.rb' - 'app/models/spree/role.rb' - 'app/models/spree/shipping_method.rb' - 'app/models/spree/user.rb' - - 'app/models/spree/variant.rb' - 'app/models/spree/zone.rb' # Offense count: 47 @@ -1071,7 +1069,7 @@ Rails/I18nLocaleTexts: Exclude: - 'app/controllers/admin/stripe_accounts_controller.rb' -# Offense count: 27 +# Offense count: 26 # Configuration parameters: IgnoreScopes, Include. # Include: app/models/**/*.rb Rails/InverseOf: @@ -1081,7 +1079,6 @@ Rails/InverseOf: - 'app/models/spree/country.rb' - 'app/models/spree/inventory_unit.rb' - 'app/models/spree/line_item.rb' - - 'app/models/spree/option_type.rb' - 'app/models/spree/order.rb' - 'app/models/spree/payment.rb' - 'app/models/spree/price.rb' @@ -1480,7 +1477,7 @@ Style/GlobalStdStream: - 'lib/tasks/subscriptions/debug.rake' - 'lib/tasks/subscriptions/test.rake' -# Offense count: 39 +# Offense count: 38 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: @@ -1499,7 +1496,6 @@ Style/GuardClause: - 'app/models/spree/order.rb' - 'app/models/spree/preferences/preferable_class_methods.rb' - 'app/services/order_syncer.rb' - - 'app/services/variant_units/variant_and_line_item_naming.rb' - 'engines/order_management/app/services/order_management/order/updater.rb' - 'lib/discourse/single_sign_on.rb' - 'lib/open_food_network/order_cycle_form_applicator.rb'