Enabled frozen string literals (#1154)

* Enabled frozen string literals

* Update rubocop config

* Prefer string interpolation in simple cases

Co-Authored-By: Dylan Thacker-Smith <dylan.smith@shopify.com>
This commit is contained in:
Mike Angell
2019-09-18 13:19:45 +10:00
committed by GitHub
parent 1dcad34b06
commit 0d26f05bb8
121 changed files with 379 additions and 150 deletions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'benchmark/ips'
require_relative 'theme_runner'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'stackprof'
require_relative 'theme_runner'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class CommentForm < Liquid::Block
Syntax = /(#{Liquid::VariableSignature}+)/

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'yaml'
module Database

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'json'
module JsonFilter

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
$LOAD_PATH.unshift(__dir__ + '/../../lib')
require_relative '../../lib/liquid'

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module MoneyFilter
def money_with_currency(money)
return '' if money.nil?

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class Paginate < Liquid::Block
Syntax = /(#{Liquid::QuotedFragment})\s*(by\s*(\d+))?/

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module ShopFilter
def asset_url(input)
"/files/1/[shop_id]/[shop_id]/assets/#{input}"

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module TagFilter
def link_to_tag(label, tag)
"<a title=\"Show tag #{tag}\" href=\"/collections/#{@context['handle']}/#{tag}\">#{label}</a>"

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module WeightFilter
def weight(grams)
format("%.2f", grams / 1000)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This profiler run simulates Shopify.
# We are looking in the tests directory for liquid files and render them within the designated layout file.
# We will also export a substantial database to liquid which the templates can render values of.