mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Update rubocop-shopify to 2.18.0 and fix new offenses
This commit is contained in:
+10
-1
@@ -174,7 +174,16 @@ Style/WordArray:
|
|||||||
|
|
||||||
# Offense count: 117
|
# Offense count: 117
|
||||||
# This cop supports safe auto-correction (--auto-correct).
|
# This cop supports safe auto-correction (--auto-correct).
|
||||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, AllowCopDirectives, AllowedPatterns.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Max: 260
|
Max: 260
|
||||||
|
|
||||||
|
Naming/PredicatePrefix:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# This is intentional - early return from begin/rescue in assignment context
|
||||||
|
Lint/NoReturnInBeginEndBlocks:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/standardfilters.rb'
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ end
|
|||||||
group :test do
|
group :test do
|
||||||
gem 'benchmark'
|
gem 'benchmark'
|
||||||
gem 'rubocop', '~> 1.82.0'
|
gem 'rubocop', '~> 1.82.0'
|
||||||
gem 'rubocop-shopify', '~> 2.12.0', require: false
|
gem 'rubocop-shopify', '~> 2.18.0', require: false
|
||||||
gem 'rubocop-performance', require: false
|
gem 'rubocop-performance', require: false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -194,8 +194,8 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def deprecated_default_context
|
def deprecated_default_context
|
||||||
warn("DEPRECATION WARNING: Condition#evaluate without a context argument is deprecated" \
|
warn("DEPRECATION WARNING: Condition#evaluate without a context argument is deprecated " \
|
||||||
" and will be removed from Liquid 6.0.0.")
|
"and will be removed from Liquid 6.0.0.")
|
||||||
Context.new
|
Context.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ module Liquid
|
|||||||
|
|
||||||
# Catch all for the method
|
# Catch all for the method
|
||||||
def liquid_method_missing(method)
|
def liquid_method_missing(method)
|
||||||
return nil unless @context&.strict_variables
|
return unless @context&.strict_variables
|
||||||
raise Liquid::UndefinedDropMethod, "undefined method #{method}"
|
raise Liquid::UndefinedDropMethod, "undefined method #{method}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ module Liquid
|
|||||||
return obj if obj.respond_to?(:strftime)
|
return obj if obj.respond_to?(:strftime)
|
||||||
|
|
||||||
if obj.is_a?(String)
|
if obj.is_a?(String)
|
||||||
return nil if obj.empty?
|
return if obj.empty?
|
||||||
obj = obj.downcase
|
obj = obj.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_slice_on_arrays
|
def test_slice_on_arrays
|
||||||
input = 'foobar'.split(//)
|
input = 'foobar'.split('')
|
||||||
assert_equal(%w(o o b), @filters.slice(input, 1, 3))
|
assert_equal(%w(o o b), @filters.slice(input, 1, 3))
|
||||||
assert_equal(%w(o o b a r), @filters.slice(input, 1, 1000))
|
assert_equal(%w(o o b a r), @filters.slice(input, 1, 1000))
|
||||||
assert_equal(%w(), @filters.slice(input, 1, 0))
|
assert_equal(%w(), @filters.slice(input, 1, 0))
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class StandardTagTest < Minitest::Test
|
|||||||
assigns = { 'condition' => "bad string here" }
|
assigns = { 'condition' => "bad string here" }
|
||||||
assert_template_result(
|
assert_template_result(
|
||||||
'',
|
'',
|
||||||
'{% case condition %}{% when "string here" %} hit {% endcase %}',\
|
'{% case condition %}{% when "string here" %} hit {% endcase %}',
|
||||||
assigns,
|
assigns,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ class ConditionUnitTest < Minitest::Test
|
|||||||
assert_equal(true, Condition.new(1, '==', 1).evaluate)
|
assert_equal(true, Condition.new(1, '==', 1).evaluate)
|
||||||
end
|
end
|
||||||
|
|
||||||
expected = "DEPRECATION WARNING: Condition#evaluate without a context argument is deprecated" \
|
expected = "DEPRECATION WARNING: Condition#evaluate without a context argument is deprecated " \
|
||||||
" and will be removed from Liquid 6.0.0."
|
"and will be removed from Liquid 6.0.0."
|
||||||
assert_includes(err.lines.map(&:strip), expected)
|
assert_includes(err.lines.map(&:strip), expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user