From b19df0dfbffd5f8976b7519f470a88512243da78 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 14 Apr 2023 16:28:20 +1000 Subject: [PATCH] Enable new Rubocop cops This detects an additional 639 offenses which I added to the todo file. From now on, when Dependabot bumps rubocop the build may fail due to new cops. But that's a great opportunity to utilise those new cops and fix violations straight away. Otherwise we'll never get to them and lose out on useful autocorrection, for example for updating deprecated syntax. --- .rubocop_styleguide.yml | 2 +- .rubocop_todo.yml | 646 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 591 insertions(+), 57 deletions(-) diff --git a/.rubocop_styleguide.yml b/.rubocop_styleguide.yml index b9316a39c8..59258df101 100644 --- a/.rubocop_styleguide.yml +++ b/.rubocop_styleguide.yml @@ -2,7 +2,7 @@ # # These are the rules we agreed upon and we work towards. AllCops: - NewCops: disable + NewCops: enable SuggestExtensions: false Exclude: - 'bin/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 645ac2fe1a..8e67899330 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` -# on 2023-04-01 00:21:28 UTC using RuboCop version 1.47.0. +# on 2023-04-14 06:27:24 UTC using RuboCop version 1.50.1. # 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 @@ -14,6 +14,28 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/DeprecatedAttributeAssignment: + Exclude: + - 'engines/catalog/catalog.gemspec' + - 'engines/dfc_provider/dfc_provider.gemspec' + - 'engines/order_management/order_management.gemspec' + - 'engines/web/web.gemspec' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequireMFA: + Exclude: + - 'engines/catalog/catalog.gemspec' + - 'engines/dfc_provider/dfc_provider.gemspec' + - 'engines/order_management/order_management.gemspec' + - 'engines/web/web.gemspec' + # Offense count: 4 # Configuration parameters: Severity, Include. # Include: **/*.gemspec @@ -63,11 +85,10 @@ Layout/BlockAlignment: Exclude: - 'spec/services/products_renderer_spec.rb' -# Offense count: 5 +# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). Layout/BlockEndNewline: Exclude: - - 'app/controllers/admin/subscriptions_controller.rb' - 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb' - 'spec/system/admin/orders_spec.rb' @@ -100,14 +121,13 @@ Layout/ExtraSpacing: Exclude: - 'spec/spec_helper.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses Layout/FirstArgumentIndentation: Exclude: - 'spec/system/admin/orders_spec.rb' - - 'spec/system/admin/products_spec.rb' # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). @@ -117,7 +137,7 @@ Layout/FirstHashElementIndentation: Exclude: - 'spec/services/products_renderer_spec.rb' -# Offense count: 13 +# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -125,31 +145,25 @@ Layout/FirstHashElementIndentation: # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit Layout/HashAlignment: Exclude: - - 'app/controllers/admin/subscriptions_controller.rb' - 'app/controllers/spree/users_controller.rb' - 'app/models/spree/image.rb' - 'spec/migrations/migrate_customer_names_spec.rb' - 'spec/models/enterprise_spec.rb' - - 'spec/support/request/stripe_stubs.rb' - 'spec/system/admin/customers_spec.rb' - 'spec/system/admin/order_spec.rb' - 'spec/system/admin/orders_spec.rb' - 'spec/system/admin/tag_rules_spec.rb' - 'spec/system/consumer/shopping/cart_spec.rb' -# Offense count: 18 +# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: normal, indented_internal_methods Layout/IndentationConsistency: Exclude: - - 'spec/system/admin/order_cycles/complex_editing_spec.rb' - 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb' - 'spec/system/admin/order_cycles/simple_spec.rb' - - 'spec/system/admin/order_spec.rb' - - 'spec/system/admin/orders_spec.rb' - 'spec/system/admin/product_import_spec.rb' - - 'spec/system/consumer/split_checkout_spec.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). @@ -165,7 +179,64 @@ Layout/LeadingCommentSpace: Exclude: - 'spec/system/admin/enterprises_spec.rb' -# Offense count: 603 +# Offense count: 114 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Exclude: + - 'app/helpers/checkout_helper.rb' + - 'engines/order_management/spec/services/order_management/order/updater_spec.rb' + - 'engines/order_management/spec/services/order_management/subscriptions/stripe_payment_setup_spec.rb' + - 'engines/web/app/helpers/web/cookies_policy_helper.rb' + - 'spec/system/admin/bulk_order_management_spec.rb' + - 'spec/system/admin/configuration/content_spec.rb' + - 'spec/system/admin/customers_spec.rb' + - 'spec/system/admin/enterprise_fees_spec.rb' + - 'spec/system/admin/enterprises/index_spec.rb' + - 'spec/system/admin/enterprises_spec.rb' + - 'spec/system/admin/order_cycles/list_spec.rb' + - 'spec/system/admin/order_cycles/simple_spec.rb' + - 'spec/system/admin/order_spec.rb' + - 'spec/system/admin/orders_spec.rb' + - 'spec/system/admin/overview_spec.rb' + - 'spec/system/admin/payment_method_spec.rb' + - 'spec/system/admin/product_import_spec.rb' + - 'spec/system/admin/subscriptions_spec.rb' + - 'spec/system/admin/tag_rules_spec.rb' + - 'spec/system/admin/users_spec.rb' + - 'spec/system/admin/variant_overrides_spec.rb' + - 'spec/system/consumer/authentication_spec.rb' + - 'spec/system/consumer/caching/shops_caching_spec.rb' + - 'spec/system/consumer/cookies_spec.rb' + - 'spec/system/consumer/shopping/cart_spec.rb' + - 'spec/system/consumer/shopping/checkout_auth_spec.rb' + - 'spec/system/consumer/shopping/checkout_spec.rb' + - 'spec/system/consumer/shopping/products_spec.rb' + - 'spec/system/consumer/shopping/shopping_spec.rb' + - 'spec/system/consumer/shopping/unit_price_spec.rb' + - 'spec/system/consumer/split_checkout_spec.rb' + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'app/mailers/spree/user_mailer.rb' + - 'engines/order_management/app/services/order_management/subscriptions/proxy_order_syncer.rb' + - 'engines/order_management/spec/services/order_management/subscriptions/stripe_payment_setup_spec.rb' + - 'spec/system/admin/configuration/content_spec.rb' + - 'spec/system/admin/customers_spec.rb' + - 'spec/system/admin/overview_spec.rb' + - 'spec/system/admin/payment_method_spec.rb' + - 'spec/system/admin/subscriptions_spec.rb' + - 'spec/system/admin/tag_rules_spec.rb' + - 'spec/system/consumer/caching/shops_caching_spec.rb' + - 'spec/system/consumer/cookies_spec.rb' + - 'spec/system/consumer/shopping/cart_spec.rb' + +# Offense count: 605 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https @@ -378,7 +449,7 @@ Layout/TrailingEmptyLines: Exclude: - 'Rakefile' -# Offense count: 69 +# Offense count: 67 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowInHeredoc. Layout/TrailingWhitespace: @@ -406,6 +477,16 @@ Layout/TrailingWhitespace: - 'spec/system/admin/shipping_methods_spec.rb' - 'spec/system/consumer/split_checkout_spec.rb' +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'app/models/calculator/flexi_rate.rb' + - 'app/models/enterprise.rb' + - 'app/models/spree/ability.rb' + - 'app/models/spree/line_item.rb' + - 'app/models/spree/preferences/store.rb' + # Offense count: 17 # Configuration parameters: AllowedMethods. # AllowedMethods: enums @@ -424,6 +505,16 @@ Lint/ConstantDefinitionInBlock: - 'spec/validators/date_time_string_validator_spec.rb' - 'spec/validators/integer_array_validator_spec.rb' +# Offense count: 8 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'app/helpers/spree/admin/base_helper.rb' + - 'app/models/enterprise.rb' + - 'app/models/spree/calculator.rb' + - 'app/models/spree/preference.rb' + - 'app/models/spree/preferences/preferable.rb' + # Offense count: 2 Lint/DuplicateMethods: Exclude: @@ -435,6 +526,30 @@ Lint/DuplicateRequire: Exclude: - 'spec/lib/open_food_network/scope_variants_to_search_spec.rb' +# Offense count: 20 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'engines/catalog/config/routes.rb' + - 'spec/components/distributor_title_component_spec.rb' + - 'spec/components/example_component_spec.rb' + - 'spec/controllers/admin/subscription_line_items_controller_spec.rb' + - 'spec/controllers/api/v0/shipments_controller_spec.rb' + - 'spec/controllers/concerns/extra_fields_spec.rb' + - 'spec/factories.rb' + - 'spec/factories/enterprise_factory.rb' + - 'spec/jobs/order_cycle_opened_job_spec.rb' + - 'spec/jobs/subscription_placement_job_spec.rb' + - 'spec/models/product_import/entry_validator_spec.rb' + - 'spec/requests/checkout/concurrency_spec.rb' + +# Offense count: 6 +# Configuration parameters: AllowComments. +Lint/EmptyClass: + Exclude: + - 'spec/controllers/spree/admin/base_controller_spec.rb' + - 'spec/lib/reports/report_loader_spec.rb' + # Offense count: 1 # Configuration parameters: AllowComments. Lint/EmptyFile: @@ -452,6 +567,26 @@ Lint/IneffectiveAccessModifier: Exclude: - 'app/models/spree/user.rb' +# Offense count: 1 +Lint/NoReturnInBeginEndBlocks: + Exclude: + - 'app/controllers/payment_gateways/stripe_controller.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/NonAtomicFileOperation: + Exclude: + - 'app/services/bulk_invoice_service.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/RedundantDirGlobSort: + Exclude: + - 'engines/catalog/spec/spec_helper.rb' + - 'engines/dfc_provider/spec/spec_helper.rb' + - 'spec/base_spec_helper.rb' + - 'spec/system_helper.rb' + # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedMethods. @@ -482,14 +617,12 @@ Lint/UselessMethodDefinition: Exclude: - 'app/models/spree/gateway.rb' -# Offense count: 13 +# Offense count: 3 # Configuration parameters: CheckForMethodsWithNoSideEffects. Lint/Void: Exclude: - - 'spec/system/admin/order_cycles/complex_editing_spec.rb' - 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb' - 'spec/system/admin/order_cycles/simple_spec.rb' - - 'spec/system/admin/order_spec.rb' # Offense count: 27 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max. @@ -746,12 +879,6 @@ Naming/AccessorMethodName: - 'spec/support/request/shop_workflow.rb' - 'spec/support/request/web_helper.rb' -# Offense count: 1 -# Configuration parameters: AsciiConstants. -Naming/AsciiIdentifiers: - Exclude: - - 'spec/system/admin/products_spec.rb' - # Offense count: 1 # Configuration parameters: ForbiddenDelimiters. # ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) @@ -791,6 +918,40 @@ Naming/VariableNumber: - 'spec/models/spree/tax_rate_spec.rb' - 'spec/requests/api/orders_spec.rb' +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExpectedOrder, Include. +# ExpectedOrder: index, show, new, edit, create, update, destroy +# Include: app/controllers/**/*.rb +Rails/ActionOrder: + Exclude: + - 'app/controllers/admin/resource_controller.rb' + - 'app/controllers/api/v0/orders_controller.rb' + - 'app/controllers/spree/admin/images_controller.rb' + - 'app/controllers/spree/admin/invoices_controller.rb' + - 'app/controllers/spree/admin/products_controller.rb' + - 'app/controllers/spree/admin/taxons_controller.rb' + - 'app/controllers/spree/admin/variants_controller.rb' + - 'app/controllers/user_confirmations_controller.rb' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/ActiveRecordCallbacksOrder: + Exclude: + - 'app/models/customer.rb' + - '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' + - 'app/models/spree/return_authorization.rb' + - 'app/models/spree/user.rb' + - 'app/models/spree/variant.rb' + # Offense count: 1 # Configuration parameters: Severity, Include. # Include: app/models/**/*.rb @@ -826,6 +987,45 @@ Rails/Blank: - 'engines/order_management/app/services/order_management/stock/package.rb' - 'lib/stripe/authorize_response_patcher.rb' +# Offense count: 17 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/CompactBlank: + Exclude: + - 'app/controllers/spree/admin/users_controller.rb' + - 'app/models/concerns/address_display.rb' + - 'app/models/spree/zone.rb' + - 'app/services/order_cycle_form.rb' + - 'lib/reporting/report_headers_builder.rb' + - 'lib/reporting/report_ruler.rb' + - 'lib/reporting/reports/enterprise_fee_summary/parameters.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Rails/DotSeparatedKeys: + Exclude: + - 'app/controllers/api/v1/base_controller.rb' + +# Offense count: 27 +# This cop supports safe autocorrection (--autocorrect). +Rails/DurationArithmetic: + Exclude: + - 'app/services/create_order_cycle.rb' + - 'spec/jobs/order_cycle_closing_job_spec.rb' + - 'spec/jobs/order_cycle_opened_job_spec.rb' + - 'spec/services/permissions/order_spec.rb' + - 'spec/services/terms_of_service_spec.rb' + - 'spec/system/admin/bulk_order_management_spec.rb' + - 'spec/system/admin/order_cycles/list_spec.rb' + - 'spec/system/admin/orders_spec.rb' + - 'spec/system/admin/reports/orders_and_fulfillment_spec.rb' + - 'spec/system/admin/reports/packing_report_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Rails/ExpandedDateRange: + Exclude: + - 'app/models/spree/product.rb' + # Offense count: 5 # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments @@ -894,17 +1094,38 @@ Rails/HelperInstanceVariable: - 'app/helpers/spree/admin/orders_helper.rb' - 'app/helpers/spree/orders_helper.rb' -# Offense count: 37 +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb +Rails/I18nLazyLookup: + Exclude: + - 'app/controllers/admin/proxy_orders_controller.rb' + +# Offense count: 8 +# Configuration parameters: Include. +# Include: spec/**/*.rb, test/**/*.rb +Rails/I18nLocaleAssignment: + Exclude: + - 'spec/controllers/user_registrations_controller_spec.rb' + - 'spec/helpers/i18n_helper_spec.rb' + - 'spec/models/spree/variant_spec.rb' + - 'spec/system/admin/order_cycles/list_spec.rb' + +# Offense count: 3 +Rails/I18nLocaleTexts: + Exclude: + - 'app/controllers/admin/stripe_accounts_controller.rb' + +# Offense count: 27 # Configuration parameters: IgnoreScopes, Include. # Include: app/models/**/*.rb Rails/InverseOf: Exclude: - - 'app/models/concerns/calculated_adjustments.rb' - 'app/models/enterprise.rb' - 'app/models/order_cycle.rb' - 'app/models/spree/adjustment.rb' - 'app/models/spree/country.rb' - - 'app/models/spree/credit_card.rb' - 'app/models/spree/inventory_unit.rb' - 'app/models/spree/line_item.rb' - 'app/models/spree/option_type.rb' @@ -912,9 +1133,7 @@ Rails/InverseOf: - 'app/models/spree/payment.rb' - 'app/models/spree/price.rb' - 'app/models/spree/product.rb' - - 'app/models/spree/shipment.rb' - 'app/models/spree/stock_item.rb' - - 'app/models/spree/tax_rate.rb' - 'app/models/spree/taxonomy.rb' - 'app/models/spree/variant.rb' - 'app/models/subscription_line_item.rb' @@ -944,6 +1163,19 @@ Rails/LexicallyScopedActionFilter: - 'app/controllers/spree/admin/zones_controller.rb' - 'app/controllers/spree/users_controller.rb' +# Offense count: 9 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/NegateInclude: + Exclude: + - 'app/controllers/admin/resource_controller.rb' + - 'app/models/calculator/weight.rb' + - 'app/models/product_import/spreadsheet_entry.rb' + - 'app/models/spree/order/checkout.rb' + - 'app/services/order_cart_reset.rb' + - 'engines/order_management/app/services/order_management/stock/estimator.rb' + - 'lib/spree/localized_number.rb' + - 'spec/support/matchers/table_matchers.rb' + # Offense count: 18 Rails/OutputSafety: Exclude: @@ -959,12 +1191,112 @@ Rails/OutputSafety: - 'lib/reporting/queries/query_interface.rb' - 'lib/spree/money.rb' +# Offense count: 29 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/Pluck: + Exclude: + - 'app/controllers/admin/variant_overrides_controller.rb' + - 'app/helpers/shop_helper.rb' + - 'app/services/cart_service.rb' + - 'app/services/sets/product_set.rb' + - 'lib/reporting/report_headers_builder.rb' + - 'spec/controllers/admin/bulk_line_items_controller_spec.rb' + - 'spec/controllers/admin/subscriptions_controller_spec.rb' + - 'spec/controllers/api/v0/order_cycles_controller_spec.rb' + - 'spec/controllers/api/v0/orders_controller_spec.rb' + - 'spec/controllers/api/v0/products_controller_spec.rb' + - 'spec/controllers/api/v0/shops_controller_spec.rb' + - 'spec/controllers/api/v0/states_controller_spec.rb' + - 'spec/controllers/api/v0/taxons_controller_spec.rb' + - 'spec/helpers/spree/admin/orders_helper_spec.rb' + - 'spec/lib/reports/lettuce_share_report_spec.rb' + - 'spec/lib/reports/users_and_enterprises_report_spec.rb' + - 'spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: conservative, aggressive +Rails/PluckInWhere: + Exclude: + - 'app/models/spree/variant.rb' + +# Offense count: 28 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/RedundantPresenceValidationOnBelongsTo: + Exclude: + - 'app/models/enterprise.rb' + - 'app/models/enterprise_fee.rb' + - 'app/models/enterprise_group.rb' + - 'app/models/enterprise_relationship.rb' + - 'app/models/enterprise_role.rb' + - 'app/models/exchange.rb' + - 'app/models/inventory_item.rb' + - 'app/models/order_cycle.rb' + - 'app/models/spree/address.rb' + - 'app/models/spree/line_item.rb' + - 'app/models/spree/order.rb' + - 'app/models/spree/product.rb' + - 'app/models/spree/product_property.rb' + - 'app/models/spree/return_authorization.rb' + - 'app/models/spree/state.rb' + - 'app/models/spree/stock_item.rb' + - 'app/models/spree/stock_movement.rb' + - 'app/models/spree/tax_rate.rb' + - 'app/models/subscription_line_item.rb' + - 'app/models/tag_rule.rb' + - 'app/models/variant_override.rb' + # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/RelativeDateConstant: Exclude: - 'lib/tasks/data/remove_transient_data.rb' +# Offense count: 58 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Include. +# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb +Rails/ResponseParsedBody: + Exclude: + - 'spec/controllers/admin/bulk_line_items_controller_spec.rb' + - 'spec/controllers/admin/customers_controller_spec.rb' + - 'spec/controllers/admin/order_cycles_controller_spec.rb' + - 'spec/controllers/admin/proxy_orders_controller_spec.rb' + - 'spec/controllers/admin/schedules_controller_spec.rb' + - 'spec/controllers/admin/stripe_accounts_controller_spec.rb' + - 'spec/controllers/admin/subscription_line_items_controller_spec.rb' + - 'spec/controllers/admin/subscriptions_controller_spec.rb' + - 'spec/controllers/cart_controller_spec.rb' + - 'spec/controllers/line_items_controller_spec.rb' + - 'spec/controllers/spree/admin/search_controller_spec.rb' + - 'spec/controllers/spree/credit_cards_controller_spec.rb' + - 'spec/controllers/user_registrations_controller_spec.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/RootPathnameMethods: + Exclude: + - 'spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb' + - 'spec/models/content_configuration_spec.rb' + - 'spec/models/terms_of_service_file_spec.rb' + - 'spec/system/admin/configuration/terms_of_service_files_spec.rb' + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +Rails/RootPublicPath: + Exclude: + - 'app/controllers/concerns/request_timeouts.rb' + - 'lib/spree/core/controller_helpers/common.rb' + - 'spec/controllers/api/v0/product_images_controller_spec.rb' + - 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb' + - 'spec/models/terms_of_service_file_spec.rb' + - 'spec/system/admin/bulk_product_update_spec.rb' + - 'spec/system/admin/enterprises/terms_and_conditions_spec.rb' + - 'spec/system/consumer/shopping/checkout_spec.rb' + - 'spec/system/consumer/shopping/embedded_groups_spec.rb' + - 'spec/system/consumer/split_checkout_spec.rb' + # Offense count: 4 # Configuration parameters: ForbiddenMethods, AllowedMethods. # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all @@ -973,6 +1305,24 @@ Rails/SkipsModelValidations: - 'app/models/variant_override.rb' - 'spec/models/spree/line_item_spec.rb' +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/SquishedSQLHeredocs: + Exclude: + - 'app/queries/customers_with_balance.rb' + - '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: 4 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. @@ -984,6 +1334,27 @@ Rails/TimeZone: - 'spec/models/spree/tax_rate_spec.rb' - 'spec/services/customer_order_cancellation_spec.rb' +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: to_fs, to_formatted_s +Rails/ToFormattedS: + Exclude: + - 'app/controllers/admin/variant_overrides_controller.rb' + - 'app/controllers/spree/admin/products_controller.rb' + - 'spec/system/admin/product_import_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/ToSWithArgument: + Exclude: + - 'app/helpers/reports_helper.rb' + +# Offense count: 1 +Rails/TransactionExitStatement: + Exclude: + - 'app/services/place_proxy_order.rb' + # Offense count: 5 # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -1002,6 +1373,77 @@ Rails/UnknownEnv: Exclude: - 'app/models/spree/app_configuration.rb' +# Offense count: 55 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/WhereEquals: + Exclude: + - 'app/controllers/spree/admin/products_controller.rb' + - 'app/mailers/producer_mailer.rb' + - 'app/models/enterprise.rb' + - 'app/models/enterprise_fee.rb' + - 'app/models/enterprise_group.rb' + - 'app/models/enterprise_relationship.rb' + - 'app/models/exchange.rb' + - 'app/models/order_cycle.rb' + - 'app/models/product_import/entry_processor.rb' + - 'app/models/proxy_order.rb' + - 'app/models/schedule.rb' + - 'app/models/spree/line_item.rb' + - 'app/models/spree/order.rb' + - 'app/models/spree/payment_method.rb' + - 'app/models/spree/product.rb' + - 'app/models/spree/shipping_method.rb' + - 'app/models/spree/variant.rb' + - 'app/models/subscription.rb' + - 'app/queries/payments_requiring_action.rb' + - 'app/serializers/api/enterprise_shopfront_serializer.rb' + - 'app/serializers/api/order_serializer.rb' + - 'lib/open_food_network/enterprise_fee_calculator.rb' + - 'lib/open_food_network/order_cycle_permissions.rb' + - 'lib/reporting/reports/customers/base.rb' + - 'lib/reporting/reports/products_and_inventory/base.rb' + - 'lib/tasks/data.rake' + - 'lib/tasks/data/anonymize_data.rake' + - 'lib/tasks/data/remove_transient_data.rb' + - 'spec/services/product_tag_rules_filterer_spec.rb' + +# Offense count: 8 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: exists, where +Rails/WhereExists: + Exclude: + - 'app/controllers/spree/admin/overview_controller.rb' + - 'app/controllers/spree/admin/tax_rates_controller.rb' + - 'app/controllers/spree/user_sessions_controller.rb' + - 'app/models/spree/preferences/store.rb' + - 'lib/tasks/sample_data/customer_factory.rb' + - 'lib/tasks/sample_data/group_factory.rb' + - 'lib/tasks/sample_data/order_cycle_factory.rb' + - 'lib/tasks/sample_data/taxon_factory.rb' + +# Offense count: 24 +# This cop supports safe autocorrection (--autocorrect). +Rails/WhereNot: + Exclude: + - 'app/controllers/spree/admin/products_controller.rb' + - 'app/models/concerns/permalink_generator.rb' + - 'app/models/enterprise.rb' + - 'app/models/enterprise_fee.rb' + - 'app/models/enterprise_relationship.rb' + - 'app/models/product_import/inventory_reset_strategy.rb' + - 'app/models/proxy_order.rb' + - 'app/models/spree/credit_card.rb' + - 'app/models/spree/product.rb' + - 'app/models/spree/variant.rb' + - 'app/models/spree/zone.rb' + - 'app/models/variant_override.rb' + - 'app/services/cap_quantity.rb' + - 'engines/catalog/app/services/catalog/product_import/products_reset_strategy.rb' + - 'engines/order_management/app/services/order_management/subscriptions/proxy_order_syncer.rb' + - 'lib/reporting/reports/users_and_enterprises/base.rb' + - 'lib/tasks/data/anonymize_data.rake' + # Offense count: 1 Security/Open: Exclude: @@ -1020,14 +1462,6 @@ Style/CaseEquality: Exclude: - 'spec/models/spree/payment_spec.rb' -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/CaseLikeIf: - Exclude: - - 'app/controllers/admin/order_cycles_controller.rb' - - 'app/models/calculator/weight.rb' - - 'app/models/spree/payment/processing.rb' - # Offense count: 25 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. @@ -1063,6 +1497,27 @@ Style/ClassVars: Exclude: - 'lib/spree/core/delegate_belongs_to.rb' +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedVars. +Style/FetchEnvVar: + Exclude: + - 'app/helpers/discourse_helper.rb' + - 'app/models/spree/preferences/configuration.rb' + - 'app/models/spree/preferences/preferable.rb' + - 'app/services/default_country.rb' + - 'spec/base_spec_helper.rb' + - 'spec/controllers/spree/credit_cards_controller_spec.rb' + - 'spec/models/order_balance_spec.rb' + - 'spec/support/vcr_setup.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/FileRead: + Exclude: + - 'lib/tasks/karma.rake' + - 'spec/services/upload_sanitizer_spec.rb' + # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. @@ -1117,27 +1572,36 @@ Style/GuardClause: - 'spec/support/request/shop_workflow.rb' - 'spec/system/support/precompile_assets.rb' +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'app/controllers/admin/column_preferences_controller.rb' + - 'app/controllers/admin/variant_overrides_controller.rb' + - 'app/controllers/spree/admin/products_controller.rb' + - 'app/models/order_cycle.rb' + - 'app/models/product_import/product_importer.rb' + - 'app/models/spree/shipping_method.rb' + - 'app/serializers/api/admin/exchange_serializer.rb' + - 'app/services/variants_stock_levels.rb' + - 'spec/controllers/admin/inventory_items_controller_spec.rb' + - 'spec/controllers/admin/variant_overrides_controller_spec.rb' + # Offense count: 1 # Configuration parameters: MinBranchesCount. Style/HashLikeCase: Exclude: - 'app/models/enterprise.rb' -# Offense count: 11 +# Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: InverseMethods, InverseBlocks. -Style/InverseMethods: +Style/MapToHash: Exclude: - - 'app/controllers/admin/resource_controller.rb' - - 'app/models/calculator/weight.rb' - - 'app/models/product_import/spreadsheet_entry.rb' - - 'app/models/spree/order/checkout.rb' - - 'app/models/spree/order_contents.rb' - - 'app/models/spree/payment.rb' - - 'app/services/order_cart_reset.rb' - - 'engines/order_management/app/services/order_management/stock/estimator.rb' - - 'lib/spree/localized_number.rb' - - 'spec/support/matchers/table_matchers.rb' + - 'lib/reporting/report_query_template.rb' + - 'lib/reporting/report_row_builder.rb' + - 'lib/reporting/reports/enterprise_fee_summary/base.rb' + - 'lib/tasks/sample_data/user_factory.rb' # Offense count: 3 Style/MissingRespondToMissing: @@ -1152,6 +1616,13 @@ Style/MultilineTernaryOperator: Exclude: - 'spec/system/admin/subscriptions_spec.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/NegatedIfElseCondition: + Exclude: + - 'app/mailers/spree/shipment_mailer.rb' + - 'spec/support/matchers/table_matchers.rb' + # Offense count: 22 # This cop supports safe autocorrection (--autocorrect). Style/NestedModifier: @@ -1167,13 +1638,18 @@ Style/NestedModifier: - 'spec/system/admin/payments_stripe_spec.rb' - 'spec/system/admin/reports_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedMethods. -# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with -Style/NestedParenthesizedCalls: +# Offense count: 36 +Style/OpenStructUse: Exclude: - - 'spec/system/admin/products_spec.rb' + - 'app/helpers/injection_helper.rb' + - 'app/models/spree/shipment.rb' + - 'lib/open_food_network/enterprise_fee_calculator.rb' + - 'lib/reporting/report_row_builder.rb' + - 'lib/reporting/report_rows_builder.rb' + - 'spec/lib/reports/report_renderer_spec.rb' + - 'spec/lib/reports/report_spec.rb' + - 'spec/lib/reports/users_and_enterprises_report_spec.rb' + - 'spec/serializers/api/enterprise_serializer_spec.rb' # Offense count: 16 # Configuration parameters: AllowedMethods. @@ -1207,12 +1683,70 @@ Style/PreferredHashMethods: Exclude: - 'app/controllers/api/v0/shipments_controller.rb' +# Offense count: 16 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: same_as_string_literals, single_quotes, double_quotes +Style/QuotedSymbols: + Exclude: + - 'app/services/exchange_products_renderer.rb' + - 'lib/stripe/credit_card_cloner.rb' + - 'spec/controllers/api/v0/exchange_products_controller_spec.rb' + - 'spec/requests/api/orders_spec.rb' + - 'spec/requests/api/v1/customers_spec.rb' + - 'spec/support/request/stripe_stubs.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'engines/dfc_provider/app/services/authorization_control.rb' + - 'spec/support/query_counter.rb' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantConstantBase: + Exclude: + - 'app/controllers/checkout_controller.rb' + - 'app/controllers/split_checkout_controller.rb' + - 'app/controllers/webhook_endpoints_controller.rb' + - 'config.ru' + - 'spec/base_spec_helper.rb' + - 'spec/helpers/checkout_helper_spec.rb' + - 'spec/models/spree/order_spec.rb' + - 'spec/models/spree/payment_method_spec.rb' + - 'spec/models/spree/payment_spec.rb' + - 'spec/queries/complete_visible_orders_spec.rb' + - 'spec/services/paypal_items_builder_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantDoubleSplatHashBraces: + Exclude: + - 'spec/system/support/cuprite_setup.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowComments. +Style/RedundantInitialize: + Exclude: + - 'spec/models/spree/gateway_spec.rb' + # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpEscape: Exclude: - 'app/models/spree/order.rb' +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantStringEscape: + Exclude: + - 'app/models/spree/calculator.rb' + - 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb' + - 'spec/system/admin/enterprise_fees_spec.rb' + # Offense count: 206 Style/Send: Exclude: