Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix YARD warnings throughout core #2636

Merged
merged 3 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/app/models/spree/distributed_amounts_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(line_items, total_amount)
@total_amount = total_amount
end

# @param [LineItem] one of the line_items distributed over
# @param line_item [LineItem] one of the line_items distributed over
# @return [BigDecimal] the weighted adjustment for this line_item
def amount(line_item)
distributed_amounts[line_item.id].to_d
Expand Down
3 changes: 2 additions & 1 deletion core/app/models/spree/inventory_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ def order=(_)
.backordered.order(Spree::Order.arel_table[:completed_at].asc)
end

# @method backordered_for_stock_item(stock_item)
# @param stock_item [Spree::StockItem] the stock item of the desired
# inventory units
# @return [ActiveRecord::Relation<Spree::InventoryUnit>] backordered
# inventory units for the given stock item
# inventory units for the given stock item
scope :backordered_for_stock_item, ->(stock_item) do
backordered_per_variant(stock_item)
.where(spree_shipments: { stock_location_id: stock_item.stock_location_id })
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def find_line_item_by_variant(variant, options = {})
# "Are these line items equal" decision.
#
# When adding to cart, an extension would send something like:
# params[:product_customizations]={...}
# params[:product_customizations]=...
#
# and would provide:
#
Expand Down
6 changes: 3 additions & 3 deletions core/app/models/spree/order_contents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def initialize(order)
# Add a line items to the order if there is inventory to do so
# and populate Promotions
#
# @params [Spree::Variant] :variant The variant the line_item should
# @param [Spree::Variant] variant The variant the line_item should
# be associated with
# @params [Integer] :quantity The line_item quantity
# @param [Hash] :options Options for the adding proccess
# @param [Integer] quantity The line_item quantity
# @param [Hash] options Options for the adding proccess
# Valid options:
# shipment: [Spree::Shipment] LineItem target shipment
#
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def display_image

# Finds the variant property rule that matches the provided option value ids.
#
# @param [Array<Integer>] list of option value ids
# @param option_value_ids [Array<Integer>] list of option value ids
# @return [Spree::VariantPropertyRule] the matching variant property rule
def find_variant_property_rule(option_value_ids)
variant_property_rules.find do |rule|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def applicable?(promotable)
#
# This is eligible if the user's most recently completed order is more than the preferred days ago
# @param order [Spree::Order]
# @option options
def eligible?(order, _options = {})
return false unless order.user

Expand Down
1 change: 0 additions & 1 deletion core/app/models/spree/promotion/rules/nth_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def applicable?(promotable)
#
# Use the first order rule if you want a promotion to be applied to the first order for a user.
# @param order [Spree::Order]
# @option options
def eligible?(order, _options = {})
return false unless order.user

Expand Down
5 changes: 3 additions & 2 deletions core/app/models/spree/tax_calculator/shipping_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class ShippingRate

# Create a new tax calculator.
#
# @param [Spree::ShippingRate] shipping_rate the shipping rate to
# calculate taxes on
# @param [Spree::Order] order the order to calculate taxes on
# @return [Spree::TaxCalculator::ShippingRate]
def initialize(order)
if order.is_a?(::Spree::ShippingRate)
Expand All @@ -37,6 +36,8 @@ def initialize(order)

# Calculate taxes for a shipping rate.
#
# @param [Spree::ShippingRate] shipping_rate the shipping rate to
# calculate taxes on
# @return [Array<Spree::Tax::ItemTax>] the calculated taxes for the
# shipping rate
def calculate(shipping_rate)
Expand Down
4 changes: 1 addition & 3 deletions core/app/models/spree/variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Variant < Spree::Base
# a parameter, the scope is limited to variants that are in stock in the
# provided stock locations.
#
# If you want to also include backorderable variants see {[suppliable}}
# If you want to also include backorderable variants see {Spree::Variant.suppliable}
#
# @param stock_locations [Array<Spree::StockLocation>] the stock locations to check
# @return [ActiveRecord::Relation]
Expand Down Expand Up @@ -282,8 +282,6 @@ def price_selector
# Chooses an appropriate price for the given pricing options
#
# @see Spree::Variant::PriceSelector#price_for
# @param [Spree::Config.pricing_options_class] An instance of pricing options
# @return [Spree::Money] The chosen price as a Money object
delegate :price_for, to: :price_selector

# Returns the difference in price from the master variant
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/wallet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def default_wallet_payment_source
end

# Change the default WalletPaymentSource for this wallet.
# @param source [WalletPaymentSource] The payment source to set as the default.
# @param wallet_payment_source [WalletPaymentSource] The payment source to set as the default.
# It must be in the wallet already. Pass nil to clear the default.
# @return [void]
def default_wallet_payment_source=(wallet_payment_source)
Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/spree/dummy/dummy_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_dummy_config

template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
template "rails/application.rb", "#{dummy_path}/config/application.rb", force: true
template "rails/application.rb.tt", "#{dummy_path}/config/application.rb", force: true
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
template "rails/test.rb", "#{dummy_path}/config/environments/test.rb", force: true
template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", force: true
Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/spree/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def prepare_options
end

def add_files
template 'config/initializers/spree.rb', 'config/initializers/spree.rb'
template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
end

def additional_tweaks
Expand Down
10 changes: 5 additions & 5 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class AppConfiguration < Preferences::Configuration
preference :inventory_cache_threshold, :integer

# @!attribute [rw] checkout_zone
# @return [String] Name of a {Zone}, which limits available countries to those included in that zone. (default: +nil+)
# @return [String] Name of a {Spree::Zone}, which limits available countries to those included in that zone. (default: +nil+)
preference :checkout_zone, :string, default: nil

# @!attribute [rw] company
Expand All @@ -118,7 +118,7 @@ class AppConfiguration < Preferences::Configuration

# @!attribute [rw] default_country_id
# @deprecated Use the default country ISO preference instead
# @return [Integer,nil] id of {Country} to be selected by default in dropdowns (default: nil)
# @return [Integer,nil] id of {Spree::Country} to be selected by default in dropdowns (default: nil)
preference :default_country_id, :integer

# @!attribute [rw] default_country_iso
Expand Down Expand Up @@ -159,7 +159,7 @@ class AppConfiguration < Preferences::Configuration
preference :max_level_in_taxons_menu, :integer, default: 1

# @!attribute [rw] order_mutex_max_age
# @return [Integer] Max age of {OrderMutex} in seconds (default: 2 minutes)
# @return [Integer] Max age of {Spree::OrderMutex} in seconds (default: 2 minutes)
preference :order_mutex_max_age, :integer, default: 120

# @!attribute [rw] orders_per_page
Expand Down Expand Up @@ -244,7 +244,7 @@ class AppConfiguration < Preferences::Configuration
# Store credits configurations

# @!attribute [rw] credit_to_new_allocation
# @return [Boolean] Creates a new allocation anytime {StoreCredit#credit} is called
# @return [Boolean] Creates a new allocation anytime {Spree::StoreCredit#credit} is called
preference :credit_to_new_allocation, :boolean, default: false

# @!attribute [rw] automatic_default_address
Expand All @@ -262,7 +262,7 @@ class AppConfiguration < Preferences::Configuration
# Allows restricting what currencies will be available.
#
# @!attribute [r] available_currencies
# @returns [Array] An array of available currencies from Money::Currency.all
# @return [Array] An array of available currencies from Money::Currency.all
attr_writer :available_currencies
def available_currencies
@available_currencies ||= ::Money::Currency.all
Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/core/role_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def instance
end

# Yields the instance of the singleton, used for configuration
# @yield_param instance [Spree::RoleConfiguration]
# @yieldparam instance [Spree::RoleConfiguration]
def configure
Spree::Deprecation.warn "Spree::RoleConfiguration.configure is deprecated. Call Spree::Config.roles.assign_permissions instead"
yield(Spree::Config.roles)
Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/core/search/variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def results
# Subclasses may override this to allow conditional filtering, etc.
#
# @api public
# @param word [String] One of the search words provided by the user.
# @param _word [String] One of the search words provided by the user.
# e.g. a SKU
# @return [Array<Symbol>] the list of search terms to use for this word
def search_terms(_word)
Expand Down