Skip to content

Commit

Permalink
Remove Usage.increment calls that have been shown to in fact be used
Browse files Browse the repository at this point in the history
I think these were added for undocumented features to see if they were
actually used and they were being used.
  • Loading branch information
dylanahsmith committed Oct 25, 2022
1 parent 6ce4ec1 commit 331f6ec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
5 changes: 1 addition & 4 deletions lib/liquid/forloop_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ def initialize(name, length, parentloop)
# @liquid_return [forloop]
attr_reader :parentloop

def name
Usage.increment('forloop_drop_name')
@name
end
attr_reader :name

# @liquid_public_docs
# @liquid_summary
Expand Down
1 change: 0 additions & 1 deletion lib/liquid/tags/for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def set_attribute(key, expr)
case key
when 'offset'
@from = if expr == 'continue'
Usage.increment('for_offset_continue')
:continue
else
parse_expression(expr)
Expand Down
26 changes: 0 additions & 26 deletions test/integration/tags/for_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -450,30 +450,4 @@ def test_for_cleans_up_registers

assert(context.registers[:for_stack].empty?)
end

def test_instrument_for_offset_continue
assert_usage_increment('for_offset_continue') do
Template.parse('{% for item in items offset:continue %}{{item}}{% endfor %}')
end

assert_usage_increment('for_offset_continue', times: 0) do
Template.parse('{% for item in items offset:2 %}{{item}}{% endfor %}')
end
end

def test_instrument_forloop_drop_name
assigns = { 'items' => [1, 2, 3, 4, 5] }

assert_usage_increment('forloop_drop_name', times: 5) do
Template.parse('{% for item in items %}{{forloop.name}}{% endfor %}').render!(assigns)
end

assert_usage_increment('forloop_drop_name', times: 0) do
Template.parse('{% for item in items %}{{forloop.index}}{% endfor %}').render!(assigns)
end

assert_usage_increment('forloop_drop_name', times: 0) do
Template.parse('{% for item in items %}{{item}}{% endfor %}').render!(assigns)
end
end
end

0 comments on commit 331f6ec

Please sign in to comment.