diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8d06d3cfad..39510bf5f5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 1400` -# on 2018-09-19 19:24:45 +0200 using RuboCop version 0.57.2. +# on 2018-10-25 13:57:32 +1100 using RuboCop version 0.57.2. # 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 @@ -57,7 +57,7 @@ Layout/AlignHash: - 'spec/models/spree/shipping_method_spec.rb' - 'spec/models/spree/variant_spec.rb' -# Offense count: 62 +# Offense count: 60 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: with_first_parameter, with_fixed_indentation @@ -67,7 +67,6 @@ Layout/AlignParameters: - 'app/models/enterprise.rb' - 'app/models/enterprise_group.rb' - 'app/models/enterprise_relationship.rb' - - 'app/models/spree/variant_decorator.rb' - 'app/serializers/api/address_serializer.rb' - 'app/serializers/api/enterprise_serializer.rb' - 'app/serializers/api/shipping_method_serializer.rb' @@ -126,7 +125,7 @@ Layout/ElseAlignment: - 'app/serializers/api/admin/order_cycle_serializer.rb' - 'lib/open_food_network/sales_tax_report.rb' -# Offense count: 201 +# Offense count: 197 # Cop supports --auto-correct. Layout/EmptyLines: Exclude: @@ -182,7 +181,6 @@ Layout/EmptyLines: - 'app/serializers/api/enterprise_serializer.rb' - 'lib/open_food_network/cached_products_renderer.rb' - 'lib/open_food_network/enterprise_fee_applicator.rb' - - 'lib/open_food_network/enterprise_fee_calculator.rb' - 'lib/open_food_network/enterprise_issue_validator.rb' - 'lib/open_food_network/integrity_checker.rb' - 'lib/open_food_network/lettuce_share_report.rb' @@ -201,7 +199,6 @@ Layout/EmptyLines: - 'lib/tasks/cache.rake' - 'lib/tasks/dev.rake' - 'lib/tasks/enterprises.rake' - - 'lib/tasks/users.rake' - 'spec/archive/features/consumer/checkout_spec.rb' - 'spec/controllers/admin/column_preferences_controller_spec.rb' - 'spec/controllers/admin/enterprises_controller_spec.rb' @@ -220,7 +217,6 @@ Layout/EmptyLines: - 'spec/features/admin/enterprises_spec.rb' - 'spec/features/admin/order_cycles_spec.rb' - 'spec/features/admin/orders_spec.rb' - - 'spec/features/admin/payment_method_spec.rb' - 'spec/features/admin/product_import_spec.rb' - 'spec/features/admin/products_spec.rb' - 'spec/features/admin/reports_spec.rb' @@ -268,7 +264,7 @@ Layout/EmptyLinesAroundArguments: Exclude: - 'spec/archive/features/consumer/checkout_spec.rb' -# Offense count: 61 +# Offense count: 59 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: empty_lines, no_empty_lines @@ -285,7 +281,6 @@ Layout/EmptyLinesAroundBlockBody: - 'lib/open_food_network/group_buy_report.rb' - 'lib/spree/money_decorator.rb' - 'lib/tasks/dev.rake' - - 'lib/tasks/users.rake' - 'spec/controllers/admin/order_cycles_controller_spec.rb' - 'spec/controllers/admin/tag_rules_controller_spec.rb' - 'spec/controllers/spree/admin/orders_controller_spec.rb' @@ -315,7 +310,6 @@ Layout/EmptyLinesAroundBlockBody: - 'spec/lib/open_food_network/user_balance_calculator_spec.rb' - 'spec/models/billable_period_spec.rb' - 'spec/models/product_distribution_spec.rb' - - 'spec/models/product_import/product_list_spec.rb' - 'spec/models/spree/ability_spec.rb' - 'spec/models/spree/product_spec.rb' - 'spec/models/tag_rule/filter_payment_methods_spec.rb' @@ -368,7 +362,7 @@ Layout/EndAlignment: - 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb' - 'app/serializers/api/admin/order_cycle_serializer.rb' -# Offense count: 49 +# Offense count: 47 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. Layout/ExtraSpacing: @@ -378,7 +372,6 @@ Layout/ExtraSpacing: - 'app/helpers/admin/injection_helper.rb' - 'app/models/enterprise.rb' - 'app/models/spree/classification_decorator.rb' - - 'app/models/spree/product_set.rb' - 'app/serializers/api/enterprise_serializer.rb' - 'config.ru' - 'lib/open_food_network/bulk_coop_report.rb' @@ -394,7 +387,6 @@ Layout/ExtraSpacing: - 'spec/features/admin/reports_spec.rb' - 'spec/features/consumer/groups_spec.rb' - 'spec/features/consumer/shopping/shopping_spec.rb' - - 'spec/helpers/cookies_policy_helper_spec.rb' - 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb' - 'spec/lib/open_food_network/reports/rule_spec.rb' - 'spec/models/enterprise_fee_spec.rb' @@ -444,7 +436,7 @@ Layout/IndentationConsistency: - 'spec/models/spree/line_item_spec.rb' - 'spec/models/spree/product_spec.rb' -# Offense count: 20 +# Offense count: 19 # Cop supports --auto-correct. # Configuration parameters: Width, IgnoredPatterns. Layout/IndentationWidth: @@ -455,7 +447,6 @@ Layout/IndentationWidth: - 'app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb' - 'app/serializers/api/admin/for_order_cycle/supplied_product_serializer.rb' - 'app/serializers/api/admin/order_cycle_serializer.rb' - - 'lib/discourse/single_sign_on.rb' - 'spec/features/consumer/shopping/variant_overrides_spec.rb' - 'spec/helpers/admin/business_model_configuration_helper_spec.rb' - 'spec/helpers/groups_helper_spec.rb' @@ -472,7 +463,7 @@ Layout/LeadingBlankLines: Exclude: - 'lib/tasks/dev.rake' -# Offense count: 46 +# Offense count: 44 # Cop supports --auto-correct. Layout/LeadingCommentSpace: Exclude: @@ -484,7 +475,6 @@ Layout/LeadingCommentSpace: - 'app/serializers/api/address_serializer.rb' - 'app/serializers/api/enterprise_serializer.rb' - 'app/serializers/api/product_serializer.rb' - - 'lib/tasks/users.rake' - 'spec/archive/features/consumer/checkout_spec.rb' - 'spec/controllers/spree/api/line_items_controller_spec.rb' - 'spec/features/admin/products_spec.rb' @@ -554,7 +544,7 @@ Layout/MultilineMethodCallIndentation: - 'spec/lib/open_food_network/cached_products_renderer_spec.rb' - 'spec/serializers/variant_serializer_spec.rb' -# Offense count: 28 +# Offense count: 26 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented @@ -566,7 +556,6 @@ Layout/MultilineOperationIndentation: - 'app/helpers/enterprises_helper.rb' - 'app/models/producer_property.rb' - 'app/models/spree/ability_decorator.rb' - - 'app/models/spree/product_set.rb' - 'app/models/variant_override_set.rb' - 'lib/open_food_network/accounts_and_billing_settings_validator.rb' - 'lib/open_food_network/order_cycle_permissions.rb' @@ -666,7 +655,7 @@ Layout/SpaceAroundEqualsInParameterDefault: - 'spec/support/request/distribution_helper.rb' - 'spec/support/request/web_helper.rb' -# Offense count: 57 +# Offense count: 55 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment. Layout/SpaceAroundOperators: @@ -686,7 +675,6 @@ Layout/SpaceAroundOperators: - 'spec/features/admin/bulk_product_update_spec.rb' - 'spec/features/consumer/shopping/checkout_spec.rb' - 'spec/helpers/checkout_helper_spec.rb' - - 'spec/helpers/cookies_policy_helper_spec.rb' - 'spec/helpers/order_cycles_helper_spec.rb' - 'spec/jobs/update_billable_periods_spec.rb' - 'spec/lib/open_food_network/order_grouper_spec.rb' @@ -798,7 +786,7 @@ Layout/SpaceInsideBlockBraces: - 'spec/spec_helper.rb' - 'spec/support/cancan_helper.rb' -# Offense count: 734 +# Offense count: 728 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. # SupportedStyles: space, no_space, compact @@ -842,7 +830,6 @@ Layout/SpaceInsideHashLiteralBraces: - 'lib/open_food_network/sales_tax_report.rb' - 'lib/open_food_network/variant_and_line_item_naming.rb' - 'lib/open_food_network/xero_invoices_report.rb' - - 'lib/tasks/users.rake' - 'spec/controllers/admin/accounts_and_billing_settings_controller_spec.rb' - 'spec/controllers/admin/business_model_configuration_controller_spec.rb' - 'spec/controllers/admin/enterprises_controller_spec.rb' @@ -948,13 +935,12 @@ Layout/TrailingBlankLines: Exclude: - 'spec/controllers/cart_controller_spec.rb' -# Offense count: 64 +# Offense count: 60 # Cop supports --auto-correct. # Configuration parameters: AllowInHeredoc. Layout/TrailingWhitespace: Exclude: - 'app/models/distributor_shipping_method.rb' - - 'app/models/spree/calculator/default_tax_decorator.rb' - 'app/models/spree/money_decorator.rb' - 'app/models/spree/product_decorator.rb' - 'app/serializers/api/image_serializer.rb' @@ -967,7 +953,6 @@ Layout/TrailingWhitespace: - 'spec/features/admin/customers_spec.rb' - 'spec/features/admin/variant_overrides_spec.rb' - 'spec/features/consumer/cookies_spec.rb' - - 'spec/helpers/cookies_policy_helper_spec.rb' - 'spec/helpers/enterprises_helper_spec.rb' - 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb' - 'spec/lib/open_food_network/group_buy_report_spec.rb' @@ -978,7 +963,6 @@ Layout/TrailingWhitespace: - 'spec/serializers/admin/enterprise_serializer_spec.rb' - 'spec/serializers/enterprise_serializer_spec.rb' - 'spec/support/request/menu_helper.rb' - - 'spec/views/json/producers.json.rabl_spec.rb' # Offense count: 1 Lint/AmbiguousOperator: @@ -1026,11 +1010,10 @@ Lint/ScriptPermission: Exclude: - 'Rakefile' -# Offense count: 5 +# Offense count: 3 Lint/ShadowingOuterLocalVariable: Exclude: - 'app/models/model_set.rb' - - 'app/models/spree/product_set.rb' - 'spec/models/model_set_spec.rb' # Offense count: 6 @@ -1110,7 +1093,7 @@ Lint/UselessAccessModifier: - 'lib/open_food_network/reports/bulk_coop_report.rb' - 'spec/lib/open_food_network/reports/report_spec.rb' -# Offense count: 246 +# Offense count: 242 # Configuration parameters: CheckForMethodsWithNoSideEffects. Lint/Void: Exclude: @@ -1125,7 +1108,6 @@ Lint/Void: - 'spec/controllers/spree/admin/variants_controller_spec.rb' - 'spec/controllers/spree/api/products_controller_spec.rb' - 'spec/controllers/spree/api/variants_controller_spec.rb' - - 'spec/controllers/user_registrations_controller_spec.rb' - 'spec/features/admin/bulk_product_update_spec.rb' - 'spec/features/admin/enterprise_groups_spec.rb' - 'spec/features/admin/enterprises/index_spec.rb' @@ -1166,11 +1148,11 @@ Lint/Void: - 'spec/serializers/enterprise_serializer_spec.rb' - 'spec/support/request/web_helper.rb' -# Offense count: 195 +# Offense count: 192 Metrics/AbcSize: Max: 293 -# Offense count: 1010 +# Offense count: 1039 # Configuration parameters: CountComments, ExcludedMethods. Metrics/BlockLength: Max: 787 @@ -1185,17 +1167,17 @@ Metrics/BlockNesting: Metrics/ClassLength: Max: 331 -# Offense count: 38 +# Offense count: 36 Metrics/CyclomaticComplexity: Max: 23 -# Offense count: 6683 +# Offense count: 2717 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: - Max: 623 + Max: 619 -# Offense count: 163 +# Offense count: 161 # Configuration parameters: CountComments. Metrics/MethodLength: Max: 95 @@ -1210,7 +1192,7 @@ Metrics/ModuleLength: Metrics/ParameterLists: Max: 8 -# Offense count: 30 +# Offense count: 28 Metrics/PerceivedComplexity: Max: 21 @@ -1317,10 +1299,11 @@ Performance/DoubleStartEndWith: Exclude: - 'app/helpers/application_helper.rb' -# Offense count: 4 +# Offense count: 5 # Cop supports --auto-correct. Performance/InefficientHashSearch: Exclude: + - 'app/models/product_import/product_importer.rb' - 'app/models/spree/payment_method_decorator.rb' - 'app/models/spree/preferences/file_configuration.rb' - 'lib/stripe/account_connector.rb' @@ -1357,11 +1340,10 @@ Performance/StringReplacement: - 'app/helpers/spree/admin/navigation_helper_decorator.rb' - 'app/models/spree/preferences/file_configuration.rb' -# Offense count: 5 +# Offense count: 4 # Cop supports --auto-correct. Performance/UnneededSort: Exclude: - - 'app/models/spree/product_decorator.rb' - 'spec/features/admin/order_cycles_spec.rb' # Offense count: 11 @@ -1430,7 +1412,7 @@ Rails/HasAndBelongsToMany: - 'app/models/spree/line_item_decorator.rb' - 'app/models/spree/payment_method_decorator.rb' -# Offense count: 29 +# Offense count: 28 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasManyOrHasOneDependent: @@ -1489,7 +1471,7 @@ Rails/OutputSafety: - 'lib/spree/money_decorator.rb' - 'spec/features/admin/orders_spec.rb' -# Offense count: 7 +# Offense count: 10 # Cop supports --auto-correct. Rails/PluralizationGrammar: Exclude: @@ -1497,6 +1479,7 @@ Rails/PluralizationGrammar: - 'spec/jobs/update_account_invoices_spec.rb' - 'spec/jobs/update_billable_periods_spec.rb' - 'spec/models/order_cycle_spec.rb' + - 'spec/models/spree/product_spec.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -1564,7 +1547,7 @@ Rails/UnknownEnv: Exclude: - 'lib/open_food_network/cached_products_renderer.rb' -# Offense count: 21 +# Offense count: 19 # Cop supports --auto-correct. # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -1578,10 +1561,9 @@ Rails/Validation: - 'app/models/order_cycle.rb' - 'app/models/product_distribution.rb' - 'app/models/spree/product_decorator.rb' - - 'app/models/spree/variant_decorator.rb' - 'app/models/variant_override.rb' -# Offense count: 20 +# Offense count: 18 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, conditionals @@ -1596,20 +1578,18 @@ Style/AndOr: - 'app/helpers/spree/admin/navigation_helper_decorator.rb' - 'app/models/spree/adjustment_decorator.rb' - 'app/models/spree/order_decorator.rb' - - 'app/models/spree/product_set.rb' - 'app/views/json/partials/_enterprise.rabl' - 'lib/spree/core/controller_helpers/respond_with_decorator.rb' -# Offense count: 2 +# Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: percent_q, bare_percent Style/BarePercentLiterals: Exclude: - 'spec/features/admin/variants_spec.rb' - - 'spec/support/request/web_helper.rb' -# Offense count: 207 +# Offense count: 212 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: braces, no_braces, context_dependent @@ -1657,6 +1637,7 @@ Style/BracesAroundHashParameters: - 'spec/controllers/spree/api/variants_controller_spec.rb' - 'spec/controllers/spree/orders_controller_spec.rb' - 'spec/controllers/user_confirmations_controller_spec.rb' + - 'spec/controllers/user_registrations_controller_spec.rb' - 'spec/features/admin/accounts_and_billing_settings_spec.rb' - 'spec/features/admin/business_model_configuration_spec.rb' - 'spec/features/admin/order_cycles_spec.rb' @@ -1800,7 +1781,7 @@ Style/CommentedKeyword: Exclude: - 'app/controllers/application_controller.rb' -# Offense count: 4 +# Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. # SupportedStyles: assign_to_condition, assign_inside_condition @@ -1808,6 +1789,7 @@ Style/ConditionalAssignment: Exclude: - 'app/controllers/checkout_controller.rb' - 'app/controllers/spree/admin/search_controller_decorator.rb' + - 'app/models/spree/calculator/per_item_decorator.rb' - 'app/models/spree/line_item_decorator.rb' - 'spec/lib/open_food_network/order_grouper_spec.rb' @@ -1861,7 +1843,7 @@ Style/FormatStringToken: - 'lib/open_food_network/sales_tax_report.rb' - 'spec/models/enterprise_spec.rb' -# Offense count: 79 +# Offense count: 80 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: @@ -1909,7 +1891,7 @@ Style/GuardClause: - 'spec/support/request/distribution_helper.rb' - 'spec/support/request/shop_workflow.rb' -# Offense count: 930 +# Offense count: 924 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys @@ -1964,7 +1946,6 @@ Style/HashSyntax: - 'app/models/spree/payment_decorator.rb' - 'app/models/spree/payment_method_decorator.rb' - 'app/models/spree/product_decorator.rb' - - 'app/models/spree/product_set.rb' - 'app/models/spree/taxon_decorator.rb' - 'app/models/spree/user_decorator.rb' - 'app/overrides/add_distributor_details_js_to_product.rb' @@ -2299,7 +2280,7 @@ Style/RedundantReturn: - 'app/models/spree/classification_decorator.rb' - 'app/serializers/api/admin/enterprise_serializer.rb' -# Offense count: 98 +# Offense count: 96 # Cop supports --auto-correct. Style/RedundantSelf: Exclude: @@ -2355,7 +2336,56 @@ Style/RescueModifier: - 'app/controllers/spree/admin/orders_controller_decorator.rb' - 'lib/tasks/data.rake' -# Offense count: 5 +# Offense count: 268 +Style/Send: + Exclude: + - 'spec/controllers/admin/subscriptions_controller_spec.rb' + - 'spec/controllers/checkout_controller_spec.rb' + - 'spec/controllers/shop_controller_spec.rb' + - 'spec/controllers/spree/admin/base_controller_spec.rb' + - 'spec/controllers/spree/orders_controller_spec.rb' + - 'spec/helpers/order_cycles_helper_spec.rb' + - 'spec/jobs/refresh_products_cache_job_spec.rb' + - 'spec/jobs/subscription_confirm_job_spec.rb' + - 'spec/jobs/subscription_placement_job_spec.rb' + - 'spec/lib/open_food_network/address_finder_spec.rb' + - 'spec/lib/open_food_network/enterprise_fee_applicator_spec.rb' + - 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb' + - 'spec/lib/open_food_network/lettuce_share_report_spec.rb' + - 'spec/lib/open_food_network/option_value_namer_spec.rb' + - 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb' + - 'spec/lib/open_food_network/permissions_spec.rb' + - 'spec/lib/open_food_network/products_and_inventory_report_spec.rb' + - 'spec/lib/open_food_network/products_cache_spec.rb' + - 'spec/lib/open_food_network/products_renderer_spec.rb' + - 'spec/lib/open_food_network/sales_tax_report_spec.rb' + - 'spec/lib/open_food_network/subscription_payment_updater_spec.rb' + - 'spec/lib/open_food_network/subscription_summarizer_spec.rb' + - 'spec/lib/open_food_network/tag_rule_applicator_spec.rb' + - 'spec/lib/open_food_network/xero_invoices_report_spec.rb' + - 'spec/lib/stripe/webhook_handler_spec.rb' + - 'spec/models/enterprise_spec.rb' + - 'spec/models/exchange_spec.rb' + - 'spec/models/order_cycle_spec.rb' + - 'spec/models/product_distribution_spec.rb' + - 'spec/models/spree/gateway/stripe_connect_spec.rb' + - 'spec/models/spree/line_item_spec.rb' + - 'spec/models/spree/order_spec.rb' + - 'spec/models/spree/payment_spec.rb' + - 'spec/models/spree/preference_spec.rb' + - 'spec/models/spree/tax_rate_spec.rb' + - 'spec/models/tag_rule/discount_order_spec.rb' + - 'spec/models/tag_rule/filter_order_cycles_spec.rb' + - 'spec/models/tag_rule/filter_payment_methods_spec.rb' + - 'spec/models/tag_rule/filter_products_spec.rb' + - 'spec/models/tag_rule/filter_shipping_methods_spec.rb' + - 'spec/services/cart_service_spec.rb' + - 'spec/spec_helper.rb' + - 'spec/support/localized_number_helper.rb' + - 'spec/support/matchers/delegate_matchers.rb' + - 'spec/support/request/web_helper.rb' + +# Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: require_parentheses, require_no_parentheses @@ -2464,7 +2494,7 @@ Style/UnneededInterpolation: - 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb' - 'spec/support/request/ui_component_helper.rb' -# Offense count: 23 +# Offense count: 22 # Cop supports --auto-correct. Style/UnneededPercentQ: Exclude: @@ -2490,10 +2520,3 @@ Style/UnneededPercentQ: - 'spec/features/admin/variants_spec.rb' - 'spec/features/consumer/account_spec.rb' - 'spec/features/consumer/producers_spec.rb' - - 'spec/support/request/web_helper.rb' - -# Offense count: 6683 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 623