diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ff59f620e9..7d398188f3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -746,17 +746,6 @@ Rails/UnknownEnv: Exclude: - 'app/models/spree/app_configuration.rb' -# Offense count: 7 -# Configuration parameters: Severity. -Rails/UnusedRenderContent: - Exclude: - - 'app/controllers/admin/bulk_line_items_controller.rb' - - 'app/controllers/admin/tag_rules_controller.rb' - - 'app/controllers/api/v0/enterprise_fees_controller.rb' - - 'app/controllers/api/v0/products_controller.rb' - - 'app/controllers/api/v0/taxons_controller.rb' - - 'app/controllers/api/v0/variants_controller.rb' - # Offense count: 1 Security/Open: Exclude: diff --git a/app/controllers/admin/bulk_line_items_controller.rb b/app/controllers/admin/bulk_line_items_controller.rb index 9537756a6c..c1d966e545 100644 --- a/app/controllers/admin/bulk_line_items_controller.rb +++ b/app/controllers/admin/bulk_line_items_controller.rb @@ -35,7 +35,7 @@ module Admin order.with_lock do if order.contents.update_item(@line_item, line_item_params) # No Content, does not trigger ng resource auto-update - render body: nil, status: :no_content + head :no_content else render json: { errors: @line_item.errors }, status: :precondition_failed end @@ -49,7 +49,7 @@ module Admin authorize! :update, order order.contents.remove(@line_item.variant) - render body: nil, status: :no_content # No Content, does not trigger ng resource auto-update + head :no_content # No Content, does not trigger ng resource auto-update end private diff --git a/app/controllers/admin/tag_rules_controller.rb b/app/controllers/admin/tag_rules_controller.rb index fd00ea66be..d7a749a3a7 100644 --- a/app/controllers/admin/tag_rules_controller.rb +++ b/app/controllers/admin/tag_rules_controller.rb @@ -5,7 +5,7 @@ module Admin respond_to :json respond_override destroy: { json: { - success: lambda { render body: nil, status: :no_content } + success: lambda { head :no_content } } } def map_by_tag diff --git a/app/controllers/api/v0/enterprise_fees_controller.rb b/app/controllers/api/v0/enterprise_fees_controller.rb index 45957672a7..25b696349d 100644 --- a/app/controllers/api/v0/enterprise_fees_controller.rb +++ b/app/controllers/api/v0/enterprise_fees_controller.rb @@ -9,7 +9,7 @@ module Api authorize! :destroy, enterprise_fee if enterprise_fee.destroy - render plain: I18n.t(:successfully_removed), status: :no_content + head :no_content else render plain: enterprise_fee.errors.full_messages.first, status: :forbidden end diff --git a/app/controllers/api/v0/products_controller.rb b/app/controllers/api/v0/products_controller.rb index 1a72047d73..a85b1986d9 100644 --- a/app/controllers/api/v0/products_controller.rb +++ b/app/controllers/api/v0/products_controller.rb @@ -44,7 +44,7 @@ module Api authorize! :delete, @product @product.destroyed_by = current_api_user @product.destroy - render json: @product, serializer: Api::Admin::ProductSerializer, status: :no_content + head :no_content end def bulk_products diff --git a/app/controllers/api/v0/taxons_controller.rb b/app/controllers/api/v0/taxons_controller.rb index c6b889af43..75e85f5435 100644 --- a/app/controllers/api/v0/taxons_controller.rb +++ b/app/controllers/api/v0/taxons_controller.rb @@ -55,7 +55,7 @@ module Api def destroy authorize! :delete, Spree::Taxon taxon.destroy - render json: taxon, serializer: Api::TaxonSerializer, status: :no_content + head :no_content end private diff --git a/app/controllers/api/v0/variants_controller.rb b/app/controllers/api/v0/variants_controller.rb index bac0579710..33131f6737 100644 --- a/app/controllers/api/v0/variants_controller.rb +++ b/app/controllers/api/v0/variants_controller.rb @@ -44,7 +44,7 @@ module Api authorize! :delete, @variant VariantDeleter.new.delete(@variant) - render json: @variant, serializer: Api::VariantSerializer, status: :no_content + head :no_content end private