mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
Bump RuboCop to 1.86.6
There were a few changes needed: * Plugins are now specified through `plugin:` config keyword. * All plugin gems need to be specified explicitly in Gemfile since they are no longer dependencies of plugins already specified explicitly. * All plugin gems need to be updated in other to use the new APIs. * One cop was renamed. * New offenses safe to correct were corrected directly with `bundle exec rubocop -a`. * New offenses unsafe to correct were added to the TODO configuration with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp`.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# The configuration is split into three files. Look into those files for more details.
|
||||
#
|
||||
require:
|
||||
plugins:
|
||||
- rubocop-capybara
|
||||
- rubocop-factory_bot
|
||||
- rubocop-rails
|
||||
|
||||
@@ -94,7 +94,7 @@ Metrics/PerceivedComplexity:
|
||||
Enabled: true
|
||||
Max: 14 # default 8
|
||||
|
||||
Naming/PredicateName:
|
||||
Naming/PredicatePrefix:
|
||||
Enabled: false
|
||||
|
||||
Naming/VariableNumber:
|
||||
|
||||
@@ -1,11 +1,44 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp`
|
||||
# using RuboCop version 1.64.1.
|
||||
# using RuboCop version 1.81.6.
|
||||
# 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: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: RequireParenthesesForMethodChains.
|
||||
Lint/AmbiguousRange:
|
||||
Exclude:
|
||||
- 'app/models/concerns/permalink_generator.rb'
|
||||
|
||||
# Offense count: 6
|
||||
Lint/CopDirectiveSyntax:
|
||||
Exclude:
|
||||
- 'app/services/orders/bulk_cancel_service.rb'
|
||||
- 'lib/tasks/simplecov.rake'
|
||||
- 'spec/models/database_spec.rb'
|
||||
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||
- 'spec/system/admin/enterprise_relationships_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Lint/DuplicateMethods:
|
||||
Exclude:
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'engines/order_management/app/services/order_management/subscriptions/form.rb'
|
||||
|
||||
# Offense count: 3
|
||||
Lint/UselessConstantScoping:
|
||||
Exclude:
|
||||
- 'app/services/weights_and_measures.rb'
|
||||
- 'lib/reporting/report_metadata_builder.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/UselessOr:
|
||||
Exclude:
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
|
||||
# Offense count: 24
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
||||
Metrics/AbcSize:
|
||||
@@ -42,7 +75,7 @@ Metrics/BlockLength:
|
||||
- 'lib/tasks/data.rake'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: CountBlocks, Max.
|
||||
# Configuration parameters: CountBlocks, CountModifierForms, Max.
|
||||
Metrics/BlockNesting:
|
||||
Exclude:
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
@@ -182,8 +215,9 @@ Metrics/PerceivedComplexity:
|
||||
- 'app/models/spree/order/checkout.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: EnforcedStyle, AllowedPatterns.
|
||||
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
|
||||
# SupportedStyles: snake_case, camelCase
|
||||
# ForbiddenIdentifiers: __id__, __send__
|
||||
Naming/MethodName:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/lib/dfc_provider/catalog_item.rb'
|
||||
@@ -195,23 +229,132 @@ Naming/MethodParameterName:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/lib/dfc_provider/catalog_item.rb'
|
||||
|
||||
# Offense count: 59
|
||||
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
||||
# AllowedMethods: call
|
||||
# WaywardPredicates: nonzero?
|
||||
Naming/PredicateMethod:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
||||
- 'app/controllers/spree/admin/overview_controller.rb'
|
||||
- 'app/controllers/spree/admin/payments_controller.rb'
|
||||
- 'app/controllers/voucher_adjustments_controller.rb'
|
||||
- 'app/forms/enterprise_fees_bulk_update.rb'
|
||||
- 'app/forms/schedule_form.rb'
|
||||
- 'app/helpers/spree/orders_helper.rb'
|
||||
- 'app/models/concerns/variant_stock.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_fee.rb'
|
||||
- 'app/models/invoice/data_presenter.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_import/entry_processor.rb'
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order_contents.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/payment/processing.rb'
|
||||
- 'app/models/spree/state_change.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/reflexes/admin/orders_reflex.rb'
|
||||
- 'app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb'
|
||||
- 'app/serializers/api/admin/index_enterprise_serializer.rb'
|
||||
- 'app/serializers/api/admin/index_order_cycle_serializer.rb'
|
||||
- 'app/serializers/api/admin/order_cycle_serializer.rb'
|
||||
- 'app/serializers/api/admin/order_serializer.rb'
|
||||
- 'app/serializers/api/admin/schedule_serializer.rb'
|
||||
- 'app/serializers/api/admin/subscription_line_item_serializer.rb'
|
||||
- 'app/serializers/api/admin/user_serializer.rb'
|
||||
- 'app/serializers/api/admin/variant_serializer.rb'
|
||||
- 'app/serializers/api/enterprise_shopfront_serializer.rb'
|
||||
- 'app/serializers/api/enterprise_thin_serializer.rb'
|
||||
- 'app/serializers/api/order_serializer.rb'
|
||||
- 'app/serializers/api/uncached_enterprise_serializer.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
- 'app/services/orders/fetch_adjustments_service.rb'
|
||||
- 'app/services/orders/workflow_service.rb'
|
||||
- 'app/services/sets/model_set.rb'
|
||||
- 'app/services/sets/order_cycle_set.rb'
|
||||
- 'app/services/sets/product_set.rb'
|
||||
- 'engines/dfc_provider/app/controllers/dfc_provider/addresses_controller.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_order.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb'
|
||||
- 'lib/tasks/data/check_invalid_address_used.rake'
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
|
||||
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
|
||||
# SupportedStyles: snake_case, camelCase
|
||||
Naming/VariableName:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/lib/dfc_provider/catalog_item.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/FindByOrAssignmentMemoization:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/customers_controller.rb'
|
||||
- 'app/controllers/admin/resource_controller.rb'
|
||||
- 'app/controllers/api/v0/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/api/v0/order_cycles_controller.rb'
|
||||
- 'lib/stripe/account_connector.rb'
|
||||
|
||||
# Offense count: 32
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/OrderArguments:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/enterprise_fees_controller.rb'
|
||||
- 'app/controllers/admin/enterprises_controller.rb'
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
- 'app/controllers/admin/product_import_controller.rb'
|
||||
- 'app/controllers/api/v0/states_controller.rb'
|
||||
- 'app/controllers/spree/admin/overview_controller.rb'
|
||||
- 'app/controllers/spree/admin/products_controller.rb'
|
||||
- 'app/helpers/enterprises_helper.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/enterprise_relationship_permission.rb'
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/schedule.rb'
|
||||
- 'app/models/spree/country.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/shipping_rate.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
- 'app/models/subscription_line_item.rb'
|
||||
- 'app/models/tag_rule.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
- 'spec/services/orders/generate_invoice_service_spec.rb'
|
||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: TransactionMethods.
|
||||
Rails/TransactionExitStatement:
|
||||
Exclude:
|
||||
- 'app/services/place_proxy_order.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/ArrayIntersect:
|
||||
Exclude:
|
||||
- 'app/models/spree/ability.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/BitwisePredicate:
|
||||
Exclude:
|
||||
- 'app/helpers/admin/enterprises_helper.rb'
|
||||
|
||||
# Offense count: 23
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
|
||||
# SupportedStyles: nested, compact
|
||||
# SupportedStylesForClasses: ~, nested, compact
|
||||
# SupportedStylesForModules: ~, nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- 'app/models/calculator/flat_percent_per_item.rb'
|
||||
@@ -237,6 +380,29 @@ Style/ClassAndModuleChildren:
|
||||
- 'lib/open_food_network/locking.rb'
|
||||
- 'spec/models/spree/payment_method_spec.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/CollectionQuerying:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/credit_cards_controller.rb'
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/payment_method.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/stripe_account.rb'
|
||||
- 'app/services/order_cycles/warning_service.rb'
|
||||
- 'lib/reporting/report_renderer.rb'
|
||||
- 'lib/tasks/sample_data.rake'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/HashSlice:
|
||||
Exclude:
|
||||
- 'app/services/product_filters.rb'
|
||||
- 'lib/reporting/report_row_builder.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/MapToHash:
|
||||
@@ -274,3 +440,22 @@ Style/OptionalBooleanParameter:
|
||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/RedundantFormat:
|
||||
Exclude:
|
||||
- 'spec/models/product_importer_spec.rb'
|
||||
- 'spec/requests/checkout/stripe_sca_spec.rb'
|
||||
- 'spec/system/consumer/account/cards_spec.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: Max.
|
||||
Style/SafeNavigationChainLength:
|
||||
Exclude:
|
||||
- 'app/controllers/concerns/extra_fields.rb'
|
||||
- 'app/services/customer_syncer.rb'
|
||||
- 'app/services/fdc_offer_broker.rb'
|
||||
- 'engines/dfc_provider/app/services/dfc_catalog.rb'
|
||||
- 'engines/dfc_provider/app/services/image_builder.rb'
|
||||
- 'engines/dfc_provider/app/services/quantitative_value_builder.rb'
|
||||
|
||||
3
Gemfile
3
Gemfile
@@ -194,8 +194,11 @@ group :development do
|
||||
gem 'query_count'
|
||||
gem 'rails-erd'
|
||||
gem 'rubocop'
|
||||
gem 'rubocop-capybara'
|
||||
gem 'rubocop-factory_bot'
|
||||
gem 'rubocop-rails'
|
||||
gem 'rubocop-rspec'
|
||||
gem 'rubocop-rspec_rails'
|
||||
gem 'spring'
|
||||
gem 'spring-commands-rspec'
|
||||
gem 'spring-commands-rubocop'
|
||||
|
||||
73
Gemfile.lock
73
Gemfile.lock
@@ -192,8 +192,8 @@ GEM
|
||||
base64 (0.3.0)
|
||||
bcp47_spec (0.2.1)
|
||||
bcrypt (3.1.20)
|
||||
benchmark (0.4.1)
|
||||
bigdecimal (3.2.2)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (3.3.1)
|
||||
bindata (2.5.0)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.18.3)
|
||||
@@ -380,7 +380,7 @@ GEM
|
||||
highline (2.0.3)
|
||||
htmlentities (4.3.4)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.5)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-js (3.9.2)
|
||||
i18n (>= 0.6.6)
|
||||
@@ -416,7 +416,7 @@ GEM
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (4.2.1)
|
||||
railties (>= 3.2.16)
|
||||
json (2.7.2)
|
||||
json (2.15.2)
|
||||
json-canonicalization (1.0.0)
|
||||
json-jwt (1.16.6)
|
||||
activesupport (>= 4.2)
|
||||
@@ -444,13 +444,14 @@ GEM
|
||||
base64
|
||||
knapsack_pro (8.1.2)
|
||||
rake
|
||||
language_server-protocol (3.17.0.3)
|
||||
language_server-protocol (3.17.0.5)
|
||||
launchy (3.0.0)
|
||||
addressable (~> 2.8)
|
||||
childprocess (~> 5.0)
|
||||
letter_opener (1.10.0)
|
||||
launchy (>= 2.2, < 4)
|
||||
link_header (0.0.8)
|
||||
lint_roller (1.1.0)
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
@@ -539,10 +540,10 @@ GEM
|
||||
paper_trail (15.1.0)
|
||||
activerecord (>= 6.1)
|
||||
request_store (~> 1.4)
|
||||
parallel (1.24.0)
|
||||
parallel (1.27.0)
|
||||
paranoia (2.6.3)
|
||||
activerecord (>= 5.1, < 7.2)
|
||||
parser (3.3.9.0)
|
||||
parser (3.3.10.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
paypal-sdk-core (0.3.4)
|
||||
@@ -560,6 +561,7 @@ GEM
|
||||
pp (0.6.2)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.6.0)
|
||||
private_address_check (0.5.0)
|
||||
pry (0.13.1)
|
||||
coderay (~> 1.1)
|
||||
@@ -671,7 +673,7 @@ GEM
|
||||
redis-client (>= 0.22.0)
|
||||
redis-client (0.26.1)
|
||||
connection_pool
|
||||
regexp_parser (2.9.2)
|
||||
regexp_parser (2.11.3)
|
||||
reline (0.6.2)
|
||||
io-console (~> 0.5)
|
||||
request_store (1.5.1)
|
||||
@@ -734,35 +736,39 @@ GEM
|
||||
rswag-ui (2.16.0)
|
||||
actionpack (>= 5.2, < 8.1)
|
||||
railties (>= 5.2, < 8.1)
|
||||
rubocop (1.64.1)
|
||||
rubocop (1.81.6)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.47.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.31.3)
|
||||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.20.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-factory_bot (2.25.1)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-rails (2.28.0)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.47.1)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-capybara (2.22.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.33.4)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.52.0, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-rspec (2.29.2)
|
||||
rubocop (~> 1.40)
|
||||
rubocop-capybara (~> 2.17)
|
||||
rubocop-factory_bot (~> 2.22)
|
||||
rubocop-rspec_rails (~> 2.28)
|
||||
rubocop-rspec_rails (2.28.3)
|
||||
rubocop (~> 1.40)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.44.0, < 2.0)
|
||||
rubocop-rspec (3.7.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec_rails (2.31.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec (~> 3.5)
|
||||
ruby-graphviz (1.2.5)
|
||||
rexml
|
||||
ruby-progressbar (1.13.0)
|
||||
@@ -873,7 +879,9 @@ GEM
|
||||
rugged (>= 0.27, < 1.10)
|
||||
simplecov
|
||||
simplecov_json_formatter
|
||||
unicode-display_width (2.5.0)
|
||||
unicode-display_width (3.2.0)
|
||||
unicode-emoji (~> 4.1)
|
||||
unicode-emoji (4.1.0)
|
||||
uniform_notifier (1.17.0)
|
||||
uri (0.13.2)
|
||||
valid_email2 (5.2.3)
|
||||
@@ -1043,8 +1051,11 @@ DEPENDENCIES
|
||||
rswag-api
|
||||
rswag-ui
|
||||
rubocop
|
||||
rubocop-capybara
|
||||
rubocop-factory_bot
|
||||
rubocop-rails
|
||||
rubocop-rspec
|
||||
rubocop-rspec_rails
|
||||
sd_notify
|
||||
select2-rails!
|
||||
shoulda-matchers
|
||||
|
||||
@@ -30,7 +30,7 @@ class SearchableDropdownComponent < ViewComponent::Base
|
||||
:aria_label, :other_attrs
|
||||
|
||||
def classes
|
||||
"fullwidth #{remove_search_plugin? ? 'no-input' : ''}"
|
||||
"fullwidth #{'no-input' if remove_search_plugin?}"
|
||||
end
|
||||
|
||||
def data
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
module Admin
|
||||
class BulkLineItemsController < Spree::Admin::BaseController
|
||||
include PaginationData
|
||||
|
||||
# GET /admin/bulk_line_items.json
|
||||
#
|
||||
def index
|
||||
|
||||
@@ -4,6 +4,7 @@ module Admin
|
||||
class ReportsController < Spree::Admin::BaseController
|
||||
include ActiveStorage::SetCurrent
|
||||
include ReportsActions
|
||||
|
||||
helper ReportsHelper
|
||||
|
||||
before_action :authorize_report, only: [:show, :create]
|
||||
|
||||
@@ -7,6 +7,7 @@ module Api
|
||||
module V0
|
||||
class ExchangeProductsController < Api::V0::BaseController
|
||||
include PaginationData
|
||||
|
||||
DEFAULT_PER_PAGE = 100
|
||||
|
||||
skip_authorization_check only: [:index]
|
||||
|
||||
@@ -7,6 +7,7 @@ module Api
|
||||
module V0
|
||||
class ProductsController < Api::V0::BaseController
|
||||
include PaginationData
|
||||
|
||||
respond_to :json
|
||||
DEFAULT_PER_PAGE = 15
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ module Spree
|
||||
module Admin
|
||||
class OrdersController < Spree::Admin::BaseController
|
||||
include OpenFoodNetwork::SpreeApiKeyLoader
|
||||
|
||||
helper CheckoutHelper
|
||||
|
||||
before_action :load_order, only: [:edit, :update, :fire, :resend, :invoice, :print]
|
||||
|
||||
@@ -10,6 +10,7 @@ module Spree
|
||||
include OpenFoodNetwork::SpreeApiKeyLoader
|
||||
include OrderCyclesHelper
|
||||
include EnterprisesHelper
|
||||
|
||||
helper ::Admin::ProductsHelper
|
||||
helper Spree::Admin::TaxCategoriesHelper
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ module Spree
|
||||
include Spree::Core::ControllerHelpers::Order
|
||||
|
||||
include I18nHelper
|
||||
|
||||
before_action :set_locale
|
||||
|
||||
# Devise::PasswordsController allows for blank passwords.
|
||||
|
||||
@@ -36,9 +36,7 @@ class ScheduleForm
|
||||
false unless @schedule.update(permitted_resource_params)
|
||||
end
|
||||
|
||||
def order_cycle_ids
|
||||
@schedule.order_cycle_ids
|
||||
end
|
||||
delegate :order_cycle_ids, to: :@schedule
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ module InjectionHelper
|
||||
|
||||
def inject_enterprise_attributes(enterprise_attributes)
|
||||
render partial: "json/injection_ams",
|
||||
locals: { name: 'enterpriseAttributes', json: enterprise_attributes.to_json.to_s }
|
||||
locals: { name: 'enterpriseAttributes', json: enterprise_attributes.to_json }
|
||||
end
|
||||
|
||||
def inject_saved_credit_cards
|
||||
|
||||
@@ -44,9 +44,7 @@ module ReportsHelper
|
||||
.pluck(:name, :id)
|
||||
end
|
||||
|
||||
def currency_symbol
|
||||
Spree::Money.currency_symbol
|
||||
end
|
||||
delegate :currency_symbol, to: :'Spree::Money'
|
||||
|
||||
def enterprise_fee_owner_ids(orders)
|
||||
EnterpriseFee.where(id: enterprise_fee_ids(orders))
|
||||
|
||||
@@ -10,9 +10,7 @@ module TermsAndConditionsHelper
|
||||
TermsOfService.required?(distributor)
|
||||
end
|
||||
|
||||
def platform_terms_required?
|
||||
TermsOfService.platform_terms_required?
|
||||
end
|
||||
delegate :platform_terms_required?, to: :TermsOfService
|
||||
|
||||
def distributor_terms_required?
|
||||
TermsOfService.distributor_terms_required?(current_order.distributor)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class BulkInvoiceJob < ApplicationJob
|
||||
include CableReady::Broadcaster
|
||||
|
||||
delegate :render, to: ActionController::Base
|
||||
attr_reader :options
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Renders a report and stores it in a given blob.
|
||||
class ReportJob < ApplicationJob
|
||||
include CableReady::Broadcaster
|
||||
|
||||
delegate :render, to: ActionController::Base
|
||||
|
||||
before_perform :enable_active_storage_urls
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'active_support/concern'
|
||||
|
||||
module LogDestroyPerformer
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
attr_accessor :destroyed_by
|
||||
|
||||
|
||||
@@ -408,7 +408,7 @@ class Enterprise < ApplicationRecord
|
||||
def category
|
||||
# Make this crazy logic human readable so we can argue about it sanely.
|
||||
cat = is_primary_producer ? "producer_" : "non_producer_"
|
||||
cat << ("sells_#{sells}")
|
||||
cat << "sells_#{sells}"
|
||||
|
||||
# Map backend cases to front end cases.
|
||||
case cat
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class Invoice
|
||||
class DataPresenter
|
||||
include ::ActionView::Helpers::NumberHelper
|
||||
|
||||
attr_reader :invoice
|
||||
|
||||
delegate :display_number, :data, :previous_invoice, to: :invoice
|
||||
@@ -142,7 +143,7 @@ class Invoice
|
||||
end
|
||||
|
||||
def paid?
|
||||
data[:payment_state] == 'paid' || data[:payment_state] == 'credit_owed'
|
||||
['paid', 'credit_owed'].include?(data[:payment_state])
|
||||
end
|
||||
|
||||
def outstanding_balance?
|
||||
|
||||
@@ -4,6 +4,7 @@ class Invoice
|
||||
class DataPresenter
|
||||
class Base
|
||||
include ::ActionView::Helpers::NumberHelper
|
||||
|
||||
attr_reader :data
|
||||
|
||||
def initialize(data)
|
||||
|
||||
@@ -81,17 +81,13 @@ module ProductImport
|
||||
@reset_counts
|
||||
end
|
||||
|
||||
def enterprises_index
|
||||
@spreadsheet_data.enterprises_index
|
||||
end
|
||||
delegate :enterprises_index, to: :@spreadsheet_data
|
||||
|
||||
def enterprise_products
|
||||
@processor&.enterprise_products
|
||||
end
|
||||
|
||||
def total_enterprise_products
|
||||
@processor.total_enterprise_products
|
||||
end
|
||||
delegate :total_enterprise_products, to: :@processor
|
||||
|
||||
def entries_json
|
||||
entries = {}
|
||||
@@ -130,13 +126,9 @@ module ProductImport
|
||||
@processor.inventory_updated
|
||||
end
|
||||
|
||||
def products_reset_count
|
||||
@processor.products_reset_count
|
||||
end
|
||||
delegate :products_reset_count, to: :@processor
|
||||
|
||||
def total_saved_count
|
||||
@processor.total_saved_count
|
||||
end
|
||||
delegate :total_saved_count, to: :@processor
|
||||
|
||||
def import_results
|
||||
{ entries: entries_json, reset_counts: }
|
||||
@@ -183,7 +175,7 @@ module ProductImport
|
||||
end
|
||||
|
||||
def staged_import?
|
||||
@import_settings&.key?(:start) && @import_settings&.key?(:end)
|
||||
@import_settings&.key?(:start) && @import_settings.key?(:end)
|
||||
end
|
||||
|
||||
def init_permissions
|
||||
|
||||
@@ -31,9 +31,7 @@ module Spree
|
||||
self.class.name.titleize.gsub("Calculator/", "")
|
||||
end
|
||||
|
||||
def description
|
||||
self.class.description
|
||||
end
|
||||
delegate :description, to: :class
|
||||
|
||||
def available?(_object)
|
||||
true
|
||||
|
||||
@@ -97,7 +97,7 @@ module Spree
|
||||
}
|
||||
validate :disallow_guest_order
|
||||
validates :email, presence: true,
|
||||
format: /\A([\w.%+\-']+)@([\w\-]+\.)+(\w{2,})\z/i,
|
||||
format: /\A([\w.%+\-']+)@([\w-]+\.)+(\w{2,})\z/i,
|
||||
if: :require_email
|
||||
|
||||
validates :order_cycle, presence: true, on: :require_distribution
|
||||
@@ -417,7 +417,7 @@ module Spree
|
||||
|
||||
# Helper methods for checkout steps
|
||||
def paid?
|
||||
payment_state == 'paid' || payment_state == 'credit_owed'
|
||||
['paid', 'credit_owed'].include?(payment_state)
|
||||
end
|
||||
|
||||
# "Checkout" is the initial state and, for card payments, "pending" is the state after auth
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
module Spree
|
||||
class ShippingMethod < ApplicationRecord
|
||||
include CalculatedAdjustments
|
||||
|
||||
DISPLAY_ON_OPTIONS = {
|
||||
both: "",
|
||||
back_end: "back_end"
|
||||
|
||||
@@ -8,24 +8,14 @@ module Api
|
||||
:open_street_map_default_latitude,
|
||||
:open_street_map_default_longitude
|
||||
|
||||
def open_street_map_enabled
|
||||
ContentConfig.open_street_map_enabled
|
||||
end
|
||||
delegate :open_street_map_enabled, to: :ContentConfig
|
||||
|
||||
def open_street_map_provider_name
|
||||
ContentConfig.open_street_map_provider_name
|
||||
end
|
||||
delegate :open_street_map_provider_name, to: :ContentConfig
|
||||
|
||||
def open_street_map_provider_options
|
||||
ContentConfig.open_street_map_provider_options
|
||||
end
|
||||
delegate :open_street_map_provider_options, to: :ContentConfig
|
||||
|
||||
def open_street_map_default_latitude
|
||||
ContentConfig.open_street_map_default_latitude
|
||||
end
|
||||
delegate :open_street_map_default_latitude, to: :ContentConfig
|
||||
|
||||
def open_street_map_default_longitude
|
||||
ContentConfig.open_street_map_default_longitude
|
||||
end
|
||||
delegate :open_street_map_default_longitude, to: :ContentConfig
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ class EmbeddedPageService
|
||||
|
||||
def embedding_without_https?
|
||||
@request.referer && URI(@request.referer).scheme != 'https' &&
|
||||
!Rails.env.test? && !Rails.env.development?
|
||||
!Rails.env.local?
|
||||
end
|
||||
|
||||
def process_embedded_request
|
||||
|
||||
@@ -31,6 +31,11 @@ module DfcProvider
|
||||
)
|
||||
end
|
||||
|
||||
def show
|
||||
product = SuppliedProductBuilder.supplied_product(variant)
|
||||
render json: DfcIo.export(product)
|
||||
end
|
||||
|
||||
def create
|
||||
supplied_product = import&.first
|
||||
|
||||
@@ -45,11 +50,6 @@ module DfcProvider
|
||||
render json: DfcIo.export(supplied_product)
|
||||
end
|
||||
|
||||
def show
|
||||
product = SuppliedProductBuilder.supplied_product(variant)
|
||||
render json: DfcIo.export(product)
|
||||
end
|
||||
|
||||
def update
|
||||
supplied_product = import&.first
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ module Web
|
||||
module V0
|
||||
class CookiesConsentController < BaseController
|
||||
include ActionController::Cookies
|
||||
|
||||
respond_to :json
|
||||
|
||||
def show
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
module Reporting
|
||||
class ReportTemplate
|
||||
include ReportsHelper
|
||||
|
||||
attr_accessor :user, :params, :ransack_params
|
||||
|
||||
delegate :render_as, :as_json, :to_html, :to_csv, :to_xlsx, :to_pdf, :to_json, to: :renderer
|
||||
|
||||
@@ -5,6 +5,7 @@ module Spree
|
||||
module ControllerHelpers
|
||||
module Common
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
helper_method :title
|
||||
helper_method :title=
|
||||
|
||||
@@ -22,9 +22,7 @@ module Spree
|
||||
|
||||
alias_method :t, :translate
|
||||
|
||||
def context
|
||||
Spree::ViewContext.context
|
||||
end
|
||||
delegate :context, to: :'Spree::ViewContext'
|
||||
|
||||
def virtual_path
|
||||
return unless context
|
||||
|
||||
@@ -5,6 +5,7 @@ require "tasks/sample_data/logging"
|
||||
module SampleData
|
||||
class OrderCycleFactory
|
||||
include Logging
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def create_samples
|
||||
log "Creating order cycles"
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace :ofn do
|
||||
ProxyOrder.find_by(order_cycle_id:)&.update!(
|
||||
order_id: nil,
|
||||
confirmed_at: nil,
|
||||
placed_at: nil)
|
||||
placed_at: nil
|
||||
)
|
||||
|
||||
# Run placement job to create orders
|
||||
SubscriptionPlacementJob.perform_now
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'spec_helper'
|
||||
module Api
|
||||
RSpec.describe V0::CustomersController do
|
||||
include AuthenticationHelper
|
||||
|
||||
render_views
|
||||
|
||||
let(:user) { create(:user) }
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'spec_helper'
|
||||
|
||||
RSpec.describe Api::V0::OrdersController do
|
||||
include AuthenticationHelper
|
||||
|
||||
render_views
|
||||
|
||||
let!(:regular_user) { create(:user) }
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'spec_helper'
|
||||
RSpec.describe Api::V0::ProductImagesController do
|
||||
include AuthenticationHelper
|
||||
include FileHelper
|
||||
|
||||
render_views
|
||||
|
||||
describe "uploading an image" do
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'spec_helper'
|
||||
|
||||
RSpec.describe Api::V0::ShopsController do
|
||||
include AuthenticationHelper
|
||||
|
||||
render_views
|
||||
|
||||
context "as a non-authenticated user" do
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'spec_helper'
|
||||
|
||||
RSpec.describe ShopsController do
|
||||
include WebHelper
|
||||
|
||||
render_views
|
||||
|
||||
let!(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) }
|
||||
|
||||
@@ -1033,8 +1033,6 @@ RSpec.describe ProductImport::ProductImporter do
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def import_data(csv_data, args = {})
|
||||
import_user = args[:import_user] || admin
|
||||
import_into = args[:import_into] || 'product_list'
|
||||
|
||||
@@ -6,6 +6,7 @@ RSpec.describe Spree::Preferences::Preferable do
|
||||
a_class = A =
|
||||
Class.new do
|
||||
include Spree::Preferences::Preferable
|
||||
|
||||
attr_reader :id
|
||||
|
||||
def initialize
|
||||
|
||||
@@ -63,8 +63,6 @@ RSpec.describe "General Settings" do
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_and_assert_message
|
||||
click_button 'Update'
|
||||
within("[class='flash success']") do
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'system_helper'
|
||||
RSpec.describe "Shipping Categories" do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
let(:admin_user) { create(:user) }
|
||||
|
||||
context 'user visits shipping categories page' do
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'system_helper'
|
||||
RSpec.describe 'Multilingual' do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
let(:admin_user) { create(:admin_user) }
|
||||
|
||||
before do
|
||||
|
||||
@@ -165,8 +165,8 @@ RSpec.xdescribe '
|
||||
|
||||
# And it should have some variants selected
|
||||
selected_initial_variants = initial_variants.take initial_variants.size - 1
|
||||
expect(oc.variants.map(&:id)).to match_array((selected_initial_variants.map(&:id) + [v1.id,
|
||||
v2.id]))
|
||||
expect(oc.variants.map(&:id)).to match_array(selected_initial_variants.map(&:id) + [v1.id,
|
||||
v2.id])
|
||||
|
||||
# And the collection details should have been updated
|
||||
expect(oc.exchanges.where(pickup_time: 'New time 0',
|
||||
|
||||
@@ -306,7 +306,7 @@ RSpec.describe 'As an enterprise user, I can manage my products' do
|
||||
|
||||
within "table.products" do
|
||||
# Products does not include the cloned product.
|
||||
expect(all_input_values).not_to match /COPY OF #{('L' * 254)}/
|
||||
expect(all_input_values).not_to match /COPY OF #{'L' * 254}/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -183,8 +183,6 @@ RSpec.describe "Packing Reports" do
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_prefilled_dates
|
||||
expect(page).to have_input "q[order_completed_at_gt]", value: open_datetime, visible: false
|
||||
expect(page).to have_input "q[order_completed_at_lt]", value: close_datetime, visible: false
|
||||
|
||||
@@ -13,8 +13,6 @@ RSpec.describe 'sitemap' do
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def return_page(website)
|
||||
# routing does not include the port of the session, this method adds it
|
||||
url = URI(page.driver.browser.url)
|
||||
|
||||
@@ -17,6 +17,7 @@ RSpec.describe DateTimeStringValidator do
|
||||
let(:instance) do
|
||||
Class.new do
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_accessor :timestamp
|
||||
|
||||
validates :timestamp, date_time_string: true
|
||||
|
||||
@@ -17,6 +17,7 @@ RSpec.describe IntegerArrayValidator do
|
||||
let(:instance) do
|
||||
Class.new do
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_accessor :ids
|
||||
|
||||
validates :ids, integer_array: true
|
||||
|
||||
@@ -4,6 +4,7 @@ require "spec_helper"
|
||||
|
||||
RSpec.describe "spree/admin/payment_methods/index.html.haml" do
|
||||
include AuthenticationHelper
|
||||
|
||||
helper Spree::Admin::NavigationHelper
|
||||
helper Spree::Admin::BaseHelper
|
||||
helper Spree::Core::Engine.routes.url_helpers
|
||||
|
||||
@@ -4,6 +4,7 @@ require "spec_helper"
|
||||
|
||||
RSpec.describe "spree/shared/_order_details.html.haml" do
|
||||
include AuthenticationHelper
|
||||
|
||||
helper Spree::BaseHelper
|
||||
helper CheckoutHelper
|
||||
helper OrderHelper
|
||||
|
||||
Reference in New Issue
Block a user