mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
Fix rubocop offenses from 1.82 upgrade
This commit is contained in:
@@ -55,7 +55,7 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def inner_parse(markup, ss, cache)
|
def inner_parse(markup, ss, cache)
|
||||||
if (markup.start_with?("(") && markup.end_with?(")")) && markup =~ RANGES_REGEX
|
if markup.start_with?("(") && markup.end_with?(")") && markup =~ RANGES_REGEX
|
||||||
return RangeLookup.parse(
|
return RangeLookup.parse(
|
||||||
Regexp.last_match(1),
|
Regexp.last_match(1),
|
||||||
Regexp.last_match(2),
|
Regexp.last_match(2),
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ module Liquid
|
|||||||
def interpolate(name, vars)
|
def interpolate(name, vars)
|
||||||
name.gsub(/%\{(\w+)\}/) do
|
name.gsub(/%\{(\w+)\}/) do
|
||||||
# raise TranslationError, "Undefined key #{$1} for interpolation in translation #{name}" unless vars[$1.to_sym]
|
# raise TranslationError, "Undefined key #{$1} for interpolation in translation #{name}" unless vars[$1.to_sym]
|
||||||
(vars[Regexp.last_match(1).to_sym]).to_s
|
vars[Regexp.last_match(1).to_sym].to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ module Liquid
|
|||||||
byte_a = byte_b = @ss.scan_byte
|
byte_a = byte_b = @ss.scan_byte
|
||||||
|
|
||||||
while byte_b
|
while byte_b
|
||||||
byte_a = @ss.scan_byte while byte_a && (byte_a != CLOSE_CURLEY && byte_a != OPEN_CURLEY)
|
byte_a = @ss.scan_byte while byte_a && byte_a != CLOSE_CURLEY && byte_a != OPEN_CURLEY
|
||||||
|
|
||||||
break unless byte_a
|
break unless byte_a
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class SecurityTest < Minitest::Test
|
|||||||
|
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
assert_equal([], (Symbol.all_symbols - current_symbols))
|
assert_equal([], Symbol.all_symbols - current_symbols)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_does_not_add_drop_methods_to_symbol_table
|
def test_does_not_add_drop_methods_to_symbol_table
|
||||||
@@ -70,7 +70,7 @@ class SecurityTest < Minitest::Test
|
|||||||
assert_equal("", Template.parse("{{ drop.custom_method_2 }}", assigns).render!)
|
assert_equal("", Template.parse("{{ drop.custom_method_2 }}", assigns).render!)
|
||||||
assert_equal("", Template.parse("{{ drop.custom_method_3 }}", assigns).render!)
|
assert_equal("", Template.parse("{{ drop.custom_method_3 }}", assigns).render!)
|
||||||
|
|
||||||
assert_equal([], (Symbol.all_symbols - current_symbols))
|
assert_equal([], Symbol.all_symbols - current_symbols)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_max_depth_nested_blocks_does_not_raise_exception
|
def test_max_depth_nested_blocks_does_not_raise_exception
|
||||||
|
|||||||
@@ -1328,7 +1328,7 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
assert_equal(1, @filters.sum(input, true))
|
assert_equal(1, @filters.sum(input, true))
|
||||||
assert_equal(0.2, @filters.sum(input, 1.0))
|
assert_equal(0.2, @filters.sum(input, 1.0))
|
||||||
assert_equal(-0.3, @filters.sum(input, 1))
|
assert_equal(-0.3, @filters.sum(input, 1))
|
||||||
assert_equal(0.4, @filters.sum(input, (1..5)))
|
assert_equal(0.4, @filters.sum(input, 1..5))
|
||||||
assert_equal(0, @filters.sum(input, nil))
|
assert_equal(0, @filters.sum(input, nil))
|
||||||
assert_equal(0, @filters.sum(input, ""))
|
assert_equal(0, @filters.sum(input, ""))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class TemplateTest < Minitest::Test
|
|||||||
assert(t.resource_limits.reached?)
|
assert(t.resource_limits.reached?)
|
||||||
|
|
||||||
t.resource_limits.render_score_limit = 200
|
t.resource_limits.render_score_limit = 200
|
||||||
assert_equal((" foo " * 100), t.render!)
|
assert_equal(" foo " * 100, t.render!)
|
||||||
refute_nil(t.resource_limits.render_score)
|
refute_nil(t.resource_limits.render_score)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class StrainerTemplateUnitTest < Minitest::Test
|
|||||||
def test_add_filter_when_wrong_filter_class
|
def test_add_filter_when_wrong_filter_class
|
||||||
c = Context.new
|
c = Context.new
|
||||||
s = c.strainer
|
s = c.strainer
|
||||||
wrong_filter = ->(v) { v.reverse }
|
wrong_filter = lambda(&:reverse)
|
||||||
|
|
||||||
exception = assert_raises(TypeError) do
|
exception = assert_raises(TypeError) do
|
||||||
s.class.add_filter(wrong_filter)
|
s.class.add_filter(wrong_filter)
|
||||||
|
|||||||
Reference in New Issue
Block a user