diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 19c27e8..992d135 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2019-08-27 22:42:50 +1000 using RuboCop version 0.74.0. +# on 2019-08-29 00:43:36 +1000 using RuboCop version 0.74.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -46,7 +46,7 @@ Layout/ClosingHeredocIndentation: Exclude: - 'test/integration/tags/for_tag_test.rb' -# Offense count: 25 +# Offense count: 27 # Cop supports --auto-correct. Layout/EmptyLineAfterGuardClause: Exclude: @@ -104,7 +104,7 @@ Lint/Void: Exclude: - 'lib/liquid/parse_context.rb' -# Offense count: 52 +# Offense count: 53 Metrics/AbcSize: Max: 56 @@ -112,7 +112,7 @@ Metrics/AbcSize: Metrics/CyclomaticComplexity: Max: 13 -# Offense count: 114 +# Offense count: 118 # Configuration parameters: CountComments, ExcludedMethods. Metrics/MethodLength: Max: 38 @@ -144,11 +144,12 @@ Naming/UncommunicativeMethodParamName: - 'test/integration/template_test.rb' - 'test/unit/condition_unit_test.rb' -# Offense count: 3 +# Offense count: 5 # Configuration parameters: EnforcedStyle. # SupportedStyles: inline, group Style/AccessModifierDeclarations: Exclude: + - 'lib/liquid/block_body.rb' - 'lib/liquid/tag.rb' - 'lib/liquid/tags/include.rb' - 'test/unit/strainer_unit_test.rb' @@ -220,7 +221,7 @@ Style/FormatStringToken: - 'test/integration/filter_test.rb' - 'test/integration/hash_ordering_test.rb' -# Offense count: 103 +# Offense count: 106 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, never @@ -244,7 +245,7 @@ Style/GuardClause: - 'lib/liquid/variable.rb' - 'test/unit/tokenizer_unit_test.rb' -# Offense count: 52 +# Offense count: 53 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: literals, strict @@ -336,7 +337,7 @@ Style/WhileUntilModifier: Exclude: - 'lib/liquid/tags/case.rb' -# Offense count: 650 +# Offense count: 665 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https diff --git a/performance/memory_profile.rb b/performance/memory_profile.rb index 9a15375..14b3770 100644 --- a/performance/memory_profile.rb +++ b/performance/memory_profile.rb @@ -30,6 +30,7 @@ class Profiler @retained << "#{report.scale_bytes(report.total_retained_memsize)} (#{report.total_retained} objects)" return if ENV['CI'] + require 'fileutils' report_file = File.join(REPORTS_DIR, "#{sanitize(phase)}.txt") FileUtils.mkdir_p(REPORTS_DIR) diff --git a/test/integration/tags/liquid_tag_test.rb b/test/integration/tags/liquid_tag_test.rb index d4be128..628eb85 100644 --- a/test/integration/tags/liquid_tag_test.rb +++ b/test/integration/tags/liquid_tag_test.rb @@ -5,72 +5,72 @@ class LiquidTagTest < Minitest::Test def test_liquid_tag assert_template_result('1 2 3', <<~LIQUID, 'array' => [1, 2, 3]) - {%- liquid - echo array | join: " " - -%} + {%- liquid + echo array | join: " " + -%} LIQUID assert_template_result('1 2 3', <<~LIQUID, 'array' => [1, 2, 3]) - {%- liquid - for value in array - echo value - unless forloop.last - echo " " - endunless - endfor - -%} + {%- liquid + for value in array + echo value + unless forloop.last + echo " " + endunless + endfor + -%} LIQUID assert_template_result('4 8 12 6', <<~LIQUID, 'array' => [1, 2, 3]) - {%- liquid - for value in array - assign double_value = value | times: 2 - echo double_value | times: 2 - unless forloop.last - echo " " - endunless - endfor + {%- liquid + for value in array + assign double_value = value | times: 2 + echo double_value | times: 2 + unless forloop.last + echo " " + endunless + endfor - echo " " - echo double_value - -%} + echo " " + echo double_value + -%} LIQUID assert_template_result('abc', <<~LIQUID) - {%- liquid echo "a" -%} - b - {%- liquid echo "c" -%} + {%- liquid echo "a" -%} + b + {%- liquid echo "c" -%} LIQUID end def test_liquid_tag_errors assert_match_syntax_error("syntax error (line 1): Unknown tag 'error'", <<~LIQUID) - {%- liquid error no such tag -%} + {%- liquid error no such tag -%} LIQUID assert_match_syntax_error("syntax error (line 7): Unknown tag 'error'", <<~LIQUID) - {{ test }} + {{ test }} - {%- - liquid - for value in array + {%- + liquid + for value in array - error no such tag - endfor - -%} + error no such tag + endfor + -%} LIQUID assert_match_syntax_error("syntax error (line 2): Unknown tag '!!! the guards are vigilant'", <<~LIQUID) - {%- liquid - !!! the guards are vigilant - -%} + {%- liquid + !!! the guards are vigilant + -%} LIQUID assert_match_syntax_error("syntax error (line 4): 'for' tag was never closed", <<~LIQUID) - {%- liquid - for value in array - echo 'forgot to close the for tag' - -%} + {%- liquid + for value in array + echo 'forgot to close the for tag' + -%} LIQUID end @@ -81,24 +81,24 @@ class LiquidTagTest < Minitest::Test def test_cannot_open_blocks_living_past_a_liquid_tag assert_match_syntax_error("syntax error (line 3): 'if' tag was never closed", <<~LIQUID) - {%- liquid - if true - -%} - {%- endif -%} + {%- liquid + if true + -%} + {%- endif -%} LIQUID end def test_quirk_can_close_blocks_created_before_a_liquid_tag assert_template_result("42", <<~LIQUID) - {%- if true -%} - 42 - {%- liquid endif -%} + {%- if true -%} + 42 + {%- liquid endif -%} LIQUID end def test_liquid_tag_in_raw assert_template_result("{% liquid echo 'test' %}\n", <<~LIQUID) - {% raw %}{% liquid echo 'test' %}{% endraw %} + {% raw %}{% liquid echo 'test' %}{% endraw %} LIQUID end end