From 361d1d52b167d83f5f9a94c659d40643ab9a0012 Mon Sep 17 00:00:00 2001 From: Tobi Lutke Date: Thu, 1 Jan 2026 20:20:50 -0500 Subject: [PATCH] Fix rubocop offenses from 1.82 upgrade --- lib/liquid/expression.rb | 2 +- lib/liquid/i18n.rb | 2 +- lib/liquid/tokenizer.rb | 2 +- test/integration/security_test.rb | 4 ++-- test/integration/standard_filter_test.rb | 2 +- test/integration/template_test.rb | 2 +- test/unit/strainer_template_unit_test.rb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/liquid/expression.rb b/lib/liquid/expression.rb index 2605c557..00c40a4c 100644 --- a/lib/liquid/expression.rb +++ b/lib/liquid/expression.rb @@ -55,7 +55,7 @@ module Liquid end 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( Regexp.last_match(1), Regexp.last_match(2), diff --git a/lib/liquid/i18n.rb b/lib/liquid/i18n.rb index 4a2885e8..98268811 100644 --- a/lib/liquid/i18n.rb +++ b/lib/liquid/i18n.rb @@ -28,7 +28,7 @@ module Liquid def interpolate(name, vars) name.gsub(/%\{(\w+)\}/) do # 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 diff --git a/lib/liquid/tokenizer.rb b/lib/liquid/tokenizer.rb index 56dd218e..8b331d93 100644 --- a/lib/liquid/tokenizer.rb +++ b/lib/liquid/tokenizer.rb @@ -117,7 +117,7 @@ module Liquid byte_a = byte_b = @ss.scan_byte 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 diff --git a/test/integration/security_test.rb b/test/integration/security_test.rb index 75f09296..f8405894 100644 --- a/test/integration/security_test.rb +++ b/test/integration/security_test.rb @@ -59,7 +59,7 @@ class SecurityTest < Minitest::Test GC.start - assert_equal([], (Symbol.all_symbols - current_symbols)) + assert_equal([], Symbol.all_symbols - current_symbols) end 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_3 }}", assigns).render!) - assert_equal([], (Symbol.all_symbols - current_symbols)) + assert_equal([], Symbol.all_symbols - current_symbols) end def test_max_depth_nested_blocks_does_not_raise_exception diff --git a/test/integration/standard_filter_test.rb b/test/integration/standard_filter_test.rb index eb95276c..4a10716d 100644 --- a/test/integration/standard_filter_test.rb +++ b/test/integration/standard_filter_test.rb @@ -1328,7 +1328,7 @@ class StandardFiltersTest < Minitest::Test assert_equal(1, @filters.sum(input, true)) assert_equal(0.2, @filters.sum(input, 1.0)) 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, "")) end diff --git a/test/integration/template_test.rb b/test/integration/template_test.rb index 92ece017..c01c7161 100644 --- a/test/integration/template_test.rb +++ b/test/integration/template_test.rb @@ -133,7 +133,7 @@ class TemplateTest < Minitest::Test assert(t.resource_limits.reached?) 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) end diff --git a/test/unit/strainer_template_unit_test.rb b/test/unit/strainer_template_unit_test.rb index a0410708..aa3f153a 100644 --- a/test/unit/strainer_template_unit_test.rb +++ b/test/unit/strainer_template_unit_test.rb @@ -8,7 +8,7 @@ class StrainerTemplateUnitTest < Minitest::Test def test_add_filter_when_wrong_filter_class c = Context.new s = c.strainer - wrong_filter = ->(v) { v.reverse } + wrong_filter = lambda(&:reverse) exception = assert_raises(TypeError) do s.class.add_filter(wrong_filter)