Neal Chambers
70e765bff6
Safely autocorrect Style/GuardClause
...
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`
2023-09-01 08:55:56 +09:00
Matt-Yorkley
e34c2acba8
Move CablecarResponses include to ApplicationController
2023-05-26 10:35:41 +01:00
Vishal Jain
84b711e130
redirect disabled user to homepage
2022-06-24 18:09:15 +05:30
François Turbelin
76ea7089d9
Implement suggestions
2022-06-21 10:08:12 +02:00
François Turbelin
bc9dcc7cbc
Block disabled users from logging in
2022-06-21 10:08:12 +02:00
Filipe
6ff2d4a9d5
Merge pull request #9109 from apricot12/8917-Link-to-enterprise-site
...
Adding a link to enterprise's own site from Order confirmation page.
2022-06-02 17:59:03 +01:00
Nihal Mohammed
af58ba523c
Renamed groups_helper to link_helper and removed strip_url method, as well as updated specs and ApplicationHelper. Added "Back To Website" button and i18n.
2022-04-26 01:38:25 +05:30
Jean-Baptiste Bellet
f47de45346
Reference splitcheckout as a checkout redirect
...
This stored in session value is used to redirect after login
Update tests as well, thanks @filipefurtad0 ! 🙏
2022-03-01 15:12:18 +01:00
Filipe
e403fc171d
Merge pull request #8808 from Matt-Yorkley/login-modal
...
Remove all Angular code from Login/Signup process
2022-02-03 19:36:44 +00:00
Matt-Yorkley
5e6dd1e6e1
Move #check_order_cycle_expiry method to OrderStockCheck and don't call it from BaseController :before_action callback
2022-01-31 15:55:35 +00:00
Matt-Yorkley
7c0a631f7f
Remove an unnecessary assignment
...
Co-authored-by: Maikel <maikel@email.org.au >
2022-01-31 08:40:58 +00:00
Matt-Yorkley
8a18a4de66
Clear up redirecting logic and path building
2022-01-29 10:08:51 +00:00
Matt-Yorkley
dfbd384c95
Refactor embedding to a Concern
2022-01-18 12:22:06 +00:00
Matt-Yorkley
05abb63036
Remove X-Frame-Options header
...
This header is largely deprecated, and is functionally replaced here by use of the frame-ancestors CSP configuration
2022-01-18 12:19:54 +00:00
Matt-Yorkley
48acc0ecd0
Add Bugsnag notice when an OC closes during checkout completion
...
This info could be useful to know whilst debugging order completion issues.
2021-11-14 13:58:15 +00:00
Matt-Yorkley
1d5077061e
Remove andand
...
This old gem implemented some functionality for handling nils which is no longer needed, as it's provided natively by Ruby with the &. operator.
2021-09-08 14:28:31 +01:00
Matt-Yorkley
85e83807cf
Merge pull request #7989 from Matt-Yorkley/invoice-display
...
Invoice display
2021-08-10 14:14:41 +02:00
Matt-Yorkley
1b112961d1
Handle request timeouts explicitly with rack-timeout
...
Puma doesn't terminate execution of long-running requests by default.
2021-07-31 13:11:10 +01:00
Matt-Yorkley
83f6132b6a
Fix shipping tax display in regular invoice template
2021-07-27 22:01:24 +01:00
Matt-Yorkley
886e03af2f
Merge pull request #7805 from Matt-Yorkley/adjustments-admin
...
[Adjustments] Admin adjustments
2021-07-27 12:23:29 +02:00
Nihal Mohammed
e5bdaa603a
Setup pagy
2021-07-14 13:17:33 +01:00
Matt-Yorkley
c60554a14a
Update display of associated tax amounts
2021-07-09 21:49:35 +01:00
Andy Brett
334b9b520a
removed deprecated calls to force_ssl; rely on config.force_ssl
2021-06-24 11:58:33 -07:00
Luis Ramos
23627c5453
Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
...
9290 issues fixed
2021-06-17 22:19:26 +01:00
Andy Brett
768c56400c
add TOS helper to application_controller.rb
2021-06-09 14:06:54 +10:00
Nihal Mohammed
122577b11b
Checkout made to redirect to shop front when OC closed
2021-05-14 02:58:41 +05:30
Andy Brett
a7331efd67
Merge pull request #7477 from luisramos0/require_dependency
...
Remove require_dependency or use require
2021-05-05 13:24:19 -07:00
Matt-Yorkley
31fc6201fc
Include payment method helper in ApplicationController
2021-05-03 14:17:54 +01:00
Matt-Yorkley
b0787e83b2
Add checkout helper
...
Fixes:
Failure/Error: super
ActionView::Template::Error:
undefined method `checkout_adjustments_for' for #<#<Class:0x000055f4bd847a30>:0x000055f4bd845c30>
# ./app/helpers/application_helper.rb:20:in `method_missing'
# ./app/views/spree/admin/orders/_invoice_table.html.haml:26:in `_app_views_spree_admin_orders__invoice_table_html_haml___3617932924646213210_47254819384740'
# ./app/views/spree/admin/orders/invoice.html.haml:67:in `_app_views_spree_admin_orders_invoice_html_haml__1476001169744481148_47254819971700'
# ./app/services/invoice_renderer.rb:8:in `render_to_string'
# ./app/controllers/spree/admin/orders_controller.rb:81:in `invoice'
# ./spec/support/controller_requests_helper.rb:49:in `process_action_with_route'
# ./spec/support/controller_requests_helper.rb:23:in `spree_get'
# ./spec/controllers/spree/admin/orders/invoices_spec.rb:58:in `block (6 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `checkout_adjustments_for' for #<#<Class:0x000055f4bd847a30>:0x000055f4bd845c30>
# ./app/helpers/application_helper.rb:20:in `method_missing'
2021-05-03 14:17:54 +01:00
Matt-Yorkley
943c00c924
WIP - Update loading of helpers in controllers
...
Rails has changed the way helpers are loaded. It's a bit weird. It was throwing lots of errors, and recommended using this setting, but now requires that all helpers are loaded explicitly. I'm not sure about this.
2021-05-03 14:17:54 +01:00
Luis Ramos
f357c3ff30
Remove require_dependency or use require
...
See here https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#require-dependency
2021-04-23 19:20:25 +01:00
Matt-Yorkley
7230d2767c
Add concern for accessing raw params hash
2021-02-18 11:02:22 +00:00
Luis Ramos
c604f4c0c6
Remove dead endpoint
2021-01-27 22:05:04 +00:00
Luis Ramos
0eab1b2339
Merge Spree::BaseController with ApplicationController
2021-01-15 21:59:16 +00:00
Matt-Yorkley
60aaf8100a
Fix some Rubocop offences
2020-11-27 14:00:29 +00:00
Matt-Yorkley
ccaff08928
Re-add ForbiddenAttributesError debugging helper
2020-11-27 14:00:28 +00:00
Matt-Yorkley
3090cfa909
Add setup for responders gem
2020-11-27 14:00:28 +00:00
Matt-Yorkley
7ddc53bb5b
Remove temporary debugging helpers added during the Rails 4 upgrade.
2020-09-12 12:25:43 +01:00
Luis Ramos
7c498a573c
Make shopfront redirect work when logging out by storing it outside session data
2020-07-31 09:05:42 +01:00
Luis Ramos
2ad2836ac6
Merge pull request #5563 from luchiago/fix-missing-closed-oc-info-i18n
...
add missing i18n key for closed OC
2020-06-25 20:33:55 +01:00
Luis Ramos
730959f85f
Fix rubocop issue
2020-06-22 17:39:20 +01:00
Luis Ramos
8a61257547
Rename all before_filter to before_action, it's the same function with a new name
2020-06-22 13:11:57 +01:00
Lucas Hiago
419b3ef26e
add missing i18n key for check hub ready for checkout
2020-06-16 19:49:43 -03:00
Lucas Hiago
e9e43c985f
add missing i18n key for closed OC
2020-06-16 19:48:24 -03:00
Luis Ramos
32a4355f09
Merge branch 'master' into 3-0-stable-mar6
2020-03-12 16:54:09 +00:00
Matt-Yorkley
933b5f1606
Fix reloading issue in dev environment
...
I constantly get `NameError: uninitialized constant Spree::AuthenticationHelpers` when touching local files and then reloading a page, and have to restart my rails server every time (in development). I read the other day that this is the best way to fix the issue, and it seems to work...
2020-03-11 15:31:25 +01:00
Matt-Yorkley
eae7dc7f2e
Temporarily add extra debugging to help with strong parameters
2020-02-22 16:24:28 +01:00
luisramos0
5fccd5fe58
Add rubocop exception for application controller class length and fix one line length issue
2020-01-12 19:42:07 +00:00
luisramos0
4658b7a533
Fix rubocop issues in app/controllers/application_controller
2019-12-28 19:10:02 +00:00
luisramos0
d0f33e7c8a
Avoid code in devise that is not needed and simply return the root path
...
This fixes a broken spec with error "No route matches {:controller=>"home"}"
2019-12-28 18:47:14 +00:00