Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
339 stars 96 forks source link

NoMethodError: undefined method '-' for nil:NilClass #470

Closed flexkit-git closed 3 years ago

flexkit-git commented 3 years ago

Exception while running LiquidTag#on_tag:

NoMethodError: undefined method `-' for nil:NilClass
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/node.rb:129:in `inside_liquid_tag?'
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks/liquid_tag.rb:16:in `on_tag’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks.rb:42:in `block in call_check_method’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/timeout.rb:97:in `block in timeout’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/timeout.rb:35:in `block in catch’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/timeout.rb:35:in `catch’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/timeout.rb:35:in `catch’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/timeout.rb:112:in `timeout’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks.rb:41:in `call_check_method’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks.rb:11:in `block in call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks.rb:10:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/checks.rb:10:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:35:in `call_checks’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:22:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `block in visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:24:in `visit’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/visitor.rb:12:in `visit_template’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/analyzer.rb:39:in `block (2 levels) in analyze_theme’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/analyzer.rb:38:in `each’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/analyzer.rb:38:in `block in analyze_theme’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check.rb:57:in `with_liquid_c_disabled’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/analyzer.rb:37:in `analyze_theme’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/handler.rb:144:in `block in analyze_and_send_offenses’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/3.0.0/benchmark.rb:293:in `measure’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/handler.rb:143:in `analyze_and_send_offenses’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/handler.rb:61:in `on_text_document_did_open’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/server.rb:105:in `process_request’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/server.rb:45:in `block in listen’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/server.rb:44:in `loop’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server/server.rb:44:in `listen’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/theme-check-1.5.2/lib/theme_check/language_server.rb:27:in `start’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/project_types/theme/commands/language_server.rb:8:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/sub_command.rb:13:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/command.rb:19:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:16:in `block (2 levels) in call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:37:in `block (2 levels) in with_logging’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb:169:in `with_id’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:36:in `block in with_logging’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-ui/lib/cli/ui.rb:176:in `log_output_to’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:35:in `with_logging’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:15:in `block in call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in `block (2 levels) in with_traps’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:44:in `block in with_traps’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:43:in `with_traps’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:14:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/executor.rb:15:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/entry_point.rb:24:in `block in call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/monorail.rb:32:in `log’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/entry_point.rb:23:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/bin/shopify:33:in `block in <main>'
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in `handle_abort’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in `call’
  /Users/expert/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/shopify-cli-2.3.0/bin/shopify:32:in `<main>'

Template: sections/template-collection.liquid Node: Liquid::Continue Markup:

continue

Check options: {:min_consecutive_statements=>5} Theme Check Version: 1.5.2 Ruby Version: 3.0.2 Platform: x86_64-darwin20 Muffin mode: activated

charlespwd commented 3 years ago

Hey @flexkit-git, thanks for reporting!

This was fixed in theme-check 1.6.1. Easiest way to upgrade would be to reinstall shopify-cli.