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

Add frozen_string_literal: true to all files #2586

Merged
merged 1 commit into from
Feb 20, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,7 @@ Bundler/OrderedGems:

Style/NumericLiterals:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec require: false
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

task default: :spec

def print_title(gem_name = '')
Expand Down
2 changes: 2 additions & 0 deletions api/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rubygems'
require 'rake'
require 'rake/testtask'
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/address_books_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class AddressBooksController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/addresses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class AddressesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spree/api/responders'

module Spree
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/checkouts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class CheckoutsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/classifications_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ClassificationsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/config_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ConfigController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/countries_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class CountriesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/credit_cards_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class CreditCardsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/images_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ImagesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/inventory_units_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class InventoryUnitsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/line_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class LineItemsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/option_types_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class OptionTypesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/option_values_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class OptionValuesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/orders_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class OrdersController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/payments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class PaymentsController < Spree::Api::BaseController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ProductPropertiesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ProductsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/promotions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class PromotionsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/properties_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class PropertiesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/resource_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Spree::Api::ResourceController < Spree::Api::BaseController
before_action :load_resource, only: [:show, :update, :destroy]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ReturnAuthorizationsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/shipments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ShipmentsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/states_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class StatesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/stock_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class StockItemsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/stock_locations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class StockLocationsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/stock_movements_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class StockMovementsController < Spree::Api::BaseController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Spree::Api::StoreCreditEventsController < Spree::Api::BaseController
def mine
if current_api_user
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/stores_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class StoresController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/taxonomies_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class TaxonomiesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/taxons_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class TaxonsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Spree::Api::UsersController < Spree::Api::ResourceController
private

Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/variants_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class VariantsController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/controllers/spree/api/zones_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
class ZonesController < Spree::Api::BaseController
Expand Down
2 changes: 2 additions & 0 deletions api/app/helpers/spree/api/api_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
module Api
module ApiHelpers
Expand Down
2 changes: 2 additions & 0 deletions api/app/models/spree/api_configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
class ApiConfiguration < Preferences::Configuration
preference :requires_authentication, :boolean, default: true
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/address_books/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.array! @user_addresses do |user_address|
json.partial!("spree/api/addresses/address", address: user_address.address)

Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/addresses/_address.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.cache! address do
json.(address, *address_attributes)
json.country do
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/addresses/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/addresses/address", address: @address)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/adjustments/_adjustment.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.cache! [I18n.locale, adjustment] do
json.(adjustment, *adjustment_attributes)
json.display_amount(adjustment.display_amount.to_s)
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/config/money.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.symbol(::Money.new(1, Spree::Config[:currency]).symbol)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/config/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

json.default_country_id(Spree::Country.default.id)
json.default_country_iso(Spree::Config[:default_country_iso])
2 changes: 2 additions & 0 deletions api/app/views/spree/api/countries/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

json.countries(@countries) { |country| json.(country, *country_attributes) }
json.partial! 'spree/api/shared/pagination', pagination: @countries
2 changes: 2 additions & 0 deletions api/app/views/spree/api/countries/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.(@country, *country_attributes)
json.states(@country.states) do |state|
json.(state, :id, :name, :abbr, :country_id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.cache! [I18n.locale, credit_card] do
json.(credit_card, *creditcard_attributes)
json.address do
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/credit_cards/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.credit_cards(@credit_cards) do |credit_card|
json.partial!("spree/api/credit_cards/credit_card", credit_card: credit_card)
end
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/credit_cards/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/credit_cards/credit_card", credit_card: @credit_card)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error I18n.t(:delete_restriction_error, scope: "spree.api")
2 changes: 2 additions & 0 deletions api/app/views/spree/api/errors/gateway_error.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error(I18n.t(:gateway_error, scope: "spree.api", text: @error))
2 changes: 2 additions & 0 deletions api/app/views/spree/api/errors/invalid_api_key.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error(I18n.t(:invalid_api_key, key: api_key, scope: "spree.api"))
2 changes: 2 additions & 0 deletions api/app/views/spree/api/errors/invalid_resource.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

json.error(I18n.t(:invalid_resource, scope: "spree.api"))
json.errors(@resource.errors.to_hash)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error(I18n.t(:must_specify_api_key, scope: "spree.api"))
2 changes: 2 additions & 0 deletions api/app/views/spree/api/errors/not_found.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error(I18n.t(:resource_not_found, scope: "spree.api"))
2 changes: 2 additions & 0 deletions api/app/views/spree/api/errors/unauthorized.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.error(I18n.t(:unauthorized, scope: "spree.api"))
2 changes: 2 additions & 0 deletions api/app/views/spree/api/images/_image.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.(image, *image_attributes)
json.(image, :viewable_type, :viewable_id)
Spree::Image.attachment_definitions[:attachment][:styles].each do |k, _v|
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/images/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.images(@images) do |image|
json.partial!("spree/api/images/image", image: image)
end
2 changes: 2 additions & 0 deletions api/app/views/spree/api/images/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/images/image", image: @image)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/inventory_units/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.(@inventory_unit, *inventory_unit_attributes)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/line_items/_line_item.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.cache! [I18n.locale, line_item] do
json.(line_item, *line_item_attributes)
json.single_display_amount(line_item.single_display_amount.to_s)
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/line_items/new.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

json.attributes(([*line_item_attributes] - [:id]))
json.required_attributes([:variant_id, :quantity])
2 changes: 2 additions & 0 deletions api/app/views/spree/api/line_items/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/line_items/line_item", line_item: @line_item)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.(option_type, *option_type_attributes)
json.option_values(option_type.option_values) do |option_value|
json.(option_value, *option_value_attributes)
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/option_types/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.array! @option_types do |option_type|
json.partial!("spree/api/option_types/option_type", option_type: option_type)
end
2 changes: 2 additions & 0 deletions api/app/views/spree/api/option_types/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/option_types/option_type", option_type: @option_type)
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.(option_value, *option_value_attributes)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/option_values/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.array! @option_values do |option_value|
json.partial!("spree/api/option_values/option_value", option_value: option_value)
end
2 changes: 2 additions & 0 deletions api/app/views/spree/api/option_values/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

json.partial!("spree/api/option_values/option_value", option_value: @option_value)
2 changes: 2 additions & 0 deletions api/app/views/spree/api/orders/_big.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.partial!("spree/api/orders/order", order: order)
json.payment_methods(order.available_payment_methods) do |payment_method|
json.(payment_method, :id, :name, :partial_name)
Expand Down
2 changes: 2 additions & 0 deletions api/app/views/spree/api/orders/_order.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

json.cache! [I18n.locale, order] do
json.(order, *order_attributes)
json.display_item_total(order.display_item_total.to_s)
Expand Down
Loading