mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Inspecting 1488 files
......................C....C.C..........................C.........C.........................C............................................C..............................................................................................................C.C........................................CC..............................C...........C...........................................................................................................................................................................................................C........................................................................................................C.......................................................C.............C...........................................................................................C..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C...C....................................................................................................................C.............
Offenses:
app/controllers/admin/enterprises_controller.rb:50:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless params[:stimulus]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:50:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless params[:stimulus]) instead of wrapping the code inside a conditional expression.
if params[:stimulus]
^^
app/controllers/admin/enterprises_controller.rb:51:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@enterprise.is_primary_producer = params[:is_primary_producer]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:52:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@enterprise.sells = params[:enterprise_sells]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:53:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
render cable_ready: cable_car.morph("#side_menu", partial("admin/shared/side_menu")) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:55:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:56:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:266:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless user_id.positive? && @enterprise.user_ids.include?(user_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:266:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless user_id.positive? && @enterprise.user_ids.include?(user_id)) instead of wrapping the code inside a conditional expression.
if user_id.positive? && @enterprise.user_ids.include?(user_id)
^^
app/controllers/admin/enterprises_controller.rb:267:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@enterprise.update_contact(user_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:268:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:270:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:272:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless attrs[:calculator_type].present? && attrs[:calculator_attributes].present?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:272:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless attrs[:calculator_type].present? && attrs[:calculator_attributes].present?) instead of wrapping the code inside a conditional expression.
if attrs[:calculator_type].present? && attrs[:calculator_attributes].present?
^^
app/controllers/admin/enterprises_controller.rb:273:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
rule.update(calculator_type: attrs[:calculator_type])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:274:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
attrs[:calculator_attributes].merge!( id: rule.calculator.id )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:275:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:278:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:279:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if spree_current_user.admin?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:279:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if spree_current_user.admin?) instead of wrapping the code inside a conditional expression.
unless spree_current_user.admin?
^^^^^^
app/controllers/admin/enterprises_controller.rb:280:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
params[:sets_enterprise_set][:collection_attributes].each do |_i, enterprise_params| ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:285:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:289:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:289:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if spree_current_user.admin? || spree_current_user == @enterprise.owner
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:289:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if spree_current_user.admin? || spree_current_user == @enterprise.owner) instead of wrapping the code inside a conditional expression.
unless spree_current_user.admin? || spree_current_user == @enterprise.owner
^^^^^^
app/controllers/admin/enterprises_controller.rb:290:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
enterprise_params.delete :sells
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:291:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:296:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:299:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if spree_current_user.admin?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:299:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if spree_current_user.admin?) instead of wrapping the code inside a conditional expression.
unless spree_current_user.admin?
^^^^^^
app/controllers/admin/enterprises_controller.rb:300:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
has_hub = spree_current_user.owned_enterprises.is_hub.any?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:301:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
new_enterprise_is_producer = Enterprise.new(enterprise_params).is_primary_producer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:302:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
enterprise_params[:sells] = has_hub && !new_enterprise_is_producer ? 'any' : 'none'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:303:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:307:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:307:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?) instead of wrapping the code inside a conditional expression.
unless ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?
^^^^^^
app/controllers/admin/enterprises_controller.rb:308:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
enterprise_params.delete :owner_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:309:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:309:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:313:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if spree_current_user.admin?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:313:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if spree_current_user.admin?) instead of wrapping the code inside a conditional expression.
unless spree_current_user.admin?
^^^^^^
app/controllers/admin/enterprises_controller.rb:314:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
bulk_params[:collection_attributes].each do |_i, enterprise_params| ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:316:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:317:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:321:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:321:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?) instead of wrapping the code inside a conditional expression.
unless ( spree_current_user == @enterprise.owner ) || spree_current_user.admin?
^^^^^^
app/controllers/admin/enterprises_controller.rb:322:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
enterprise_params.delete :user_ids
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:323:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/enterprises_controller.rb:325:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/enterprises_controller.rb:332:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/order_cycles_controller.rb:185:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless json_request?
^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:185:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless json_request?) instead of wrapping the code inside a conditional expression.
if json_request?
^^
app/controllers/admin/order_cycles_controller.rb:188:9: C: [Corrected] Layout/CommentIndentation: Incorrect indentation detected (column 8 instead of 6).
# to limit returned ocs to recent or undated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:188:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
orders_close_at_gt = raw_params[:q]&.delete(:orders_close_at_gt) || 31.days.ago
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:189:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
raw_params[:q] = { ...
^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:194:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@collection = collection
^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:195:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/order_cycles_controller.rb:196:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/order_cycles_controller.rb:248:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if Enterprise.managed_by(spree_current_user).include?(@order_cycle.coordinator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:248:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if Enterprise.managed_by(spree_current_user).include?(@order_cycle.coordinator)) instead of wrapping the code inside a conditional expression.
unless Enterprise.managed_by(spree_current_user).include?(@order_cycle.coordinator)
^^^^^^
app/controllers/admin/order_cycles_controller.rb:249:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
order_cycle_params.delete_if do |k, _v| ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/order_cycles_controller.rb:252:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/order_cycles_controller.rb:254:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/product_import_controller.rb:59:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if params[:file] || (params[:filepath] && File.exist?(params[:filepath]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/product_import_controller.rb:59:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if params[:file] || (params[:filepath] && File.exist?(params[:filepath]))) instead of wrapping the code inside a conditional expression.
unless params[:file] || (params[:filepath] && File.exist?(params[:filepath]))
^^^^^^
app/controllers/admin/product_import_controller.rb:60:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to '/admin/product_import', notice: I18n.t(:product_import_file_not_found_notice)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/product_import_controller.rb:61:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/product_import_controller.rb:62:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/admin/product_import_controller.rb:93:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if importer.item_count
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/product_import_controller.rb:93:7: C: [Corrected] Style/GuardClause: Use a guard clause (return if importer.item_count) instead of wrapping the code inside a conditional expression.
unless importer.item_count
^^^^^^
app/controllers/admin/product_import_controller.rb:94:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to '/admin/product_import', ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/product_import_controller.rb:96:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
true
^^^^
app/controllers/admin/product_import_controller.rb:97:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/admin/product_import_controller.rb:99:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/api/v0/shipments_controller.rb:48:11: C: Style/GuardClause: Use a guard clause (unless @shipment.can_ready?; render(json: { error: I18n.t(:cannot_ready, scope: "spree.api.shipment") },
status: :unprocessable_entity) && return; end) instead of wrapping the code inside a conditional expression.
if @shipment.can_ready?
^^
app/controllers/application_controller.rb:118:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if (@distributor = current_distributor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:118:5: C: [Corrected] Style/GuardClause: Use a guard clause (return if (@distributor = current_distributor)) instead of wrapping the code inside a conditional expression.
unless (@distributor = current_distributor)
^^^^^^
app/controllers/application_controller.rb:119:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to main_app.root_path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:120:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
false
^^^^^
app/controllers/application_controller.rb:121:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/application_controller.rb:122:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/application_controller.rb:125:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if current_order_cycle
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:125:5: C: [Corrected] Style/GuardClause: Use a guard clause (return if current_order_cycle) instead of wrapping the code inside a conditional expression.
unless current_order_cycle
^^^^^^
app/controllers/application_controller.rb:126:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to main_app.shop_path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:127:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/application_controller.rb:129:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/application_controller.rb:131:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless current_distributor_closed?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:131:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless current_distributor_closed?) instead of wrapping the code inside a conditional expression.
if current_distributor_closed?
^^
app/controllers/application_controller.rb:132:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
current_order.empty!
^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:133:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
current_order.set_distribution! nil, nil
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:134:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
flash[:info] = I18n.t('order_cycles_closed_for_hub')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:135:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to main_app.root_url
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:136:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/application_controller.rb:139:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/home_controller.rb:7:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless ContentConfig.home_show_stats
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/home_controller.rb:7:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless ContentConfig.home_show_stats) instead of wrapping the code inside a conditional expression.
if ContentConfig.home_show_stats
^^
app/controllers/home_controller.rb:8:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@num_distributors = cached_count('distributors', Enterprise.is_distributor.activated.visible)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/home_controller.rb:9:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@num_producers = cached_count('producers', Enterprise.is_primary_producer.activated.visible)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/home_controller.rb:10:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@num_orders = cached_count('orders', Spree::Order.complete)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/home_controller.rb:11:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@num_users = cached_count( ...
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/home_controller.rb:14:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/home_controller.rb:15:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/spree/orders_controller.rb:136:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless params[:order] && params[:order][:line_items_attributes]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/spree/orders_controller.rb:136:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless params[:order] && params[:order][:line_items_attributes]) instead of wrapping the code inside a conditional expression.
if params[:order] && params[:order][:line_items_attributes]
^^
app/controllers/spree/orders_controller.rb:137:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
params[:order][:line_items_attributes] = ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/spree/orders_controller.rb:139:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/spree/orders_controller.rb:140:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/controllers/spree/orders_controller.rb:183:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless items.empty?
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/spree/orders_controller.rb:183:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless items.empty?) instead of wrapping the code inside a conditional expression.
if items.empty?
^^
app/controllers/spree/orders_controller.rb:184:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
flash[:error] = I18n.t(:orders_cannot_remove_the_final_item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/spree/orders_controller.rb:185:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
redirect_to main_app.order_path(order_to_update)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/spree/orders_controller.rb:186:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/controllers/spree/orders_controller.rb:188:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/enterprise.rb:518:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if owner.can_own_more_enterprises?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:518:5: C: [Corrected] Style/GuardClause: Use a guard clause (return if owner.can_own_more_enterprises?) instead of wrapping the code inside a conditional expression.
unless owner.can_own_more_enterprises?
^^^^^^
app/models/enterprise.rb:519:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
errors.add(:owner, I18n.t(:enterprise_owner_error, email: owner.email, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:521:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/enterprise.rb:522:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/enterprise.rb:546:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless is_hub
^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:546:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless is_hub) instead of wrapping the code inside a conditional expression.
if is_hub
^^
app/models/enterprise.rb:547:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
enterprises.is_primary_producer.each do |enterprise| ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:553:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/enterprise.rb:555:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/enterprise.rb:557:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if preferred_shopfront_taxon_order =~ /\A((\d+,)*\d+)?\z/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:557:5: C: [Corrected] Style/GuardClause: Use a guard clause (return if preferred_shopfront_taxon_order =~ /\A((\d+,)*\d+)?\z/) instead of wrapping the code inside a conditional expression.
unless preferred_shopfront_taxon_order =~ /\A((\d+,)*\d+)?\z/
^^^^^^
app/models/enterprise.rb:558:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
errors.add(:shopfront_category_ordering, "must contain a list of taxons.")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:559:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/enterprise.rb:562:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/enterprise.rb:563:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return if preferred_shopfront_producer_order =~ /\A((\d+,)*\d+)?\z/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:563:5: C: [Corrected] Style/GuardClause: Use a guard clause (return if preferred_shopfront_producer_order =~ /\A((\d+,)*\d+)?\z/) instead of wrapping the code inside a conditional expression.
unless preferred_shopfront_producer_order =~ /\A((\d+,)*\d+)?\z/
^^^^^^
app/models/enterprise.rb:564:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
errors.add(:shopfront_category_ordering, "must contain a list of producers.")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:565:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/enterprise.rb:569:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/enterprise_group.rb:80:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless permalink.blank? || permalink_changed?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise_group.rb:80:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless permalink.blank? || permalink_changed?) instead of wrapping the code inside a conditional expression.
if permalink.blank? || permalink_changed?
^^
app/models/enterprise_group.rb:81:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
requested = permalink.presence || permalink_was.presence || name.presence || 'group'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise_group.rb:82:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
self.permalink = create_unique_permalink(requested.parameterize)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise_group.rb:83:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/enterprise_group.rb:84:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/producer_property.rb:16:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless name.present?
^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/producer_property.rb:16:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless name.present?) instead of wrapping the code inside a conditional expression.
if name.present?
^^
app/models/producer_property.rb:16:12: C: [Correctable] Rails/Blank: Use if name.blank? instead of unless name.present?.
return unless name.present?
^^^^^^^^^^^^^^^^^^^^
app/models/producer_property.rb:17:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
self.property = Spree::Property.find_by(name: name) || ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/producer_property.rb:19:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/producer_property.rb:20:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/product_import/entry_processor.rb:42:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless total_saved_count.zero?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/product_import/entry_processor.rb:42:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless total_saved_count.zero?) instead of wrapping the code inside a conditional expression.
if total_saved_count.zero?
^^
app/models/product_import/entry_processor.rb:43:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@importer.errors.add(:importer, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/product_import/entry_processor.rb:45:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/product_import/entry_processor.rb:46:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/spree/order.rb:506:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless !completed? && shipments.any?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/order.rb:506:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless !completed? && shipments.any?) instead of wrapping the code inside a conditional expression.
if !completed? && shipments.any?
^^
app/models/spree/order.rb:507:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
shipments.destroy_all
^^^^^^^^^^^^^^^^^^^^^
app/models/spree/order.rb:508:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
restart_checkout_flow
^^^^^^^^^^^^^^^^^^^^^
app/models/spree/order.rb:509:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/spree/order.rb:510:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/models/spree/preferences/preferable_class_methods.rb:67:9: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless method_defined? preference_description_getter_method(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/preferences/preferable_class_methods.rb:67:9: C: [Corrected] Style/GuardClause: Use a guard clause (return unless method_defined? preference_description_getter_method(name)) instead of wrapping the code inside a conditional expression.
if method_defined? preference_description_getter_method(name)
^^
app/models/spree/preferences/preferable_class_methods.rb:68:11: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
remove_method preference_description_getter_method(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/preferences/preferable_class_methods.rb:69:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/models/spree/preferences/preferable_class_methods.rb:70:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
app/services/order_syncer.rb:90:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless !pickup_to_delivery || order.shipment.blank?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/order_syncer.rb:90:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless !pickup_to_delivery || order.shipment.blank?) instead of wrapping the code inside a conditional expression.
if !pickup_to_delivery || order.shipment.blank?
^^
app/services/order_syncer.rb:91:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
order.updater.shipping_address_from_distributor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/order_syncer.rb:92:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
app/services/order_syncer.rb:93:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
engines/order_management/app/services/order_management/order/updater.rb:166:9: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless payment.completed? || order.completed?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
engines/order_management/app/services/order_management/order/updater.rb:166:9: C: [Corrected] Style/GuardClause: Use a guard clause (return unless payment.completed? || order.completed?) instead of wrapping the code inside a conditional expression.
if payment.completed? || order.completed?
^^
engines/order_management/app/services/order_management/order/updater.rb:167:11: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
persist_totals
^^^^^^^^^^^^^^
engines/order_management/app/services/order_management/order/updater.rb:168:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
engines/order_management/app/services/order_management/order/updater.rb:169:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
lib/discourse/single_sign_on.rb:33:9: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
raise "Bad signature for payload #{diags}" unless parsed["sso"] =~ %r{[^a-zA-Z0-9=\r\n/+]}m
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/discourse/single_sign_on.rb:33:9: C: [Corrected] Style/GuardClause: Use a guard clause (raise "Bad signature for payload #{diags}" unless parsed["sso"] =~ %r{[^a-zA-Z0-9=\r\n/+]}m) instead of wrapping the code inside a conditional expression.
if parsed["sso"] =~ %r{[^a-zA-Z0-9=\r\n/+]}m
^^
lib/discourse/single_sign_on.rb:34:11: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
raise "The SSO field should be Base64 encoded, using only A-Z, a-z, 0-9, +, /, " \ ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/discourse/single_sign_on.rb:37:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/discourse/single_sign_on.rb:38:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/discourse/single_sign_on.rb:39:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected.
lib/discourse/single_sign_on.rb:39:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/discourse/single_sign_on.rb:40:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected.
lib/open_food_network/order_cycle_form_applicator.rb:76:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless manages_coordinator?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:76:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless manages_coordinator?) instead of wrapping the code inside a conditional expression.
if manages_coordinator?
^^
lib/open_food_network/order_cycle_form_applicator.rb:77:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
exchange.save!
^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:78:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
ExchangeVariantBulkUpdater.new(exchange).update!(variant_ids) unless variant_ids.nil?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:80:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
@touched_exchanges << exchange
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:81:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/open_food_network/order_cycle_form_applicator.rb:82:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
lib/open_food_network/order_cycle_form_applicator.rb:107:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless manages_coordinator?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:107:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless manages_coordinator?) instead of wrapping the code inside a conditional expression.
if manages_coordinator?
^^
lib/open_food_network/order_cycle_form_applicator.rb:108:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
untouched_exchanges.each(&:destroy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/open_food_network/order_cycle_form_applicator.rb:109:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/open_food_network/order_cycle_form_applicator.rb:111:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
lib/spree/core/controller_helpers/respond_with.rb:42:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
raise ActionController::UnknownFormat unless format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/spree/core/controller_helpers/respond_with.rb:42:7: C: [Corrected] Style/GuardClause: Use a guard clause (raise ActionController::UnknownFormat unless format) instead of wrapping the code inside a conditional expression.
if format
^^
lib/spree/core/controller_helpers/respond_with.rb:43:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
_process_format(format)
^^^^^^^^^^^^^^^^^^^^^^^
lib/spree/core/controller_helpers/respond_with.rb:44:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
collector
^^^^^^^^^
lib/spree/core/controller_helpers/respond_with.rb:45:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/spree/core/controller_helpers/respond_with.rb:46:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
lib/spree/core/controller_helpers/respond_with.rb:46:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/spree/core/controller_helpers/respond_with.rb:47:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected.
lib/spree/core/controller_helpers/respond_with.rb:47:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
lib/spree/core/controller_helpers/respond_with.rb:48:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected.
lib/spree/core/controller_helpers/respond_with.rb:48:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
spec/support/request/distribution_helper.rb:10:7: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless order_cycle && page.has_select?('order_order_cycle_id')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/request/distribution_helper.rb:10:7: C: [Corrected] Style/GuardClause: Use a guard clause (return unless order_cycle && page.has_select?('order_order_cycle_id')) instead of wrapping the code inside a conditional expression.
if order_cycle && page.has_select?('order_order_cycle_id')
^^
spec/support/request/distribution_helper.rb:11:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
select_by_value order_cycle.id, from: 'order_order_cycle_id'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/request/distribution_helper.rb:12:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/support/request/distribution_helper.rb:13:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
spec/support/request/shop_workflow.rb:127:5: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return unless oc.exchanges.from_enterprise(supplier).incoming.empty?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/request/shop_workflow.rb:127:5: C: [Corrected] Style/GuardClause: Use a guard clause (return unless oc.exchanges.from_enterprise(supplier).incoming.empty?) instead of wrapping the code inside a conditional expression.
if oc.exchanges.from_enterprise(supplier).incoming.empty?
^^
spec/support/request/shop_workflow.rb:128:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
create(:exchange, order_cycle: oc, incoming: true, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/request/shop_workflow.rb:130:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/support/request/shop_workflow.rb:131:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
spec/system/support/precompile_assets.rb:18:5: C: [Corrected] Style/GuardClause: Use a guard clause (next if Webpacker.dev_server.running?) instead of wrapping the code inside a conditional expression.
if Webpacker.dev_server.running?
^^
spec/system/support/precompile_assets.rb:19:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/support/precompile_assets.rb:20:1: C: [Corrected] Layout/EmptyLines: Extra blank line detected.
spec/system/support/precompile_assets.rb:20:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
spec/system/support/precompile_assets.rb:21:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
$stdout.puts "\n Precompiling assets.\n"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/support/precompile_assets.rb:23:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected.
Webpacker.compile
^^^^^^^^^^^^^^^^^
spec/system/support/precompile_assets.rb:24:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end.
spec/system/support/precompile_assets.rb:24:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
1488 files inspected, 220 offenses detected, 218 offenses corrected, 1 more offense can be corrected with `rubocop -A`
32 lines
796 B
Ruby
32 lines
796 B
Ruby
# frozen_string_literal: true
|
|
|
|
class HomeController < BaseController
|
|
layout 'darkswarm'
|
|
|
|
def index
|
|
return unless ContentConfig.home_show_stats
|
|
|
|
@num_distributors = cached_count('distributors', Enterprise.is_distributor.activated.visible)
|
|
@num_producers = cached_count('producers', Enterprise.is_primary_producer.activated.visible)
|
|
@num_orders = cached_count('orders', Spree::Order.complete)
|
|
@num_users = cached_count(
|
|
'users', Spree::Order.complete.select('DISTINCT spree_orders.user_id')
|
|
)
|
|
end
|
|
|
|
def sell; end
|
|
|
|
def unauthorized
|
|
render 'shared/unauthorized', status: :unauthorized
|
|
end
|
|
|
|
private
|
|
|
|
# Cache the value of the query count
|
|
def cached_count(statistic, query)
|
|
CacheService.home_stats(statistic) do
|
|
query.count
|
|
end
|
|
end
|
|
end
|