Closed kyohei-shimada closed 7 years ago
I have the same error
$ haml-lint app/views/
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.3-compliant syntax, but you are running 2.3.4.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
undefined method `each' for nil:NilClass
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:68:in `visit_tag'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:19:in `visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `block in visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `each'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:14:in `block in visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:103:in `visit_script'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:122:in `visit_silent_script'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:19:in `visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `block in visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `each'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:14:in `block in visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:103:in `visit_script'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:19:in `visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `block in visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `each'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:30:in `visit_children'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:14:in `block in visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:52:in `visit_root'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:19:in `visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/ruby_extractor.rb:41:in `extract'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/linter/rubocop.rb:11:in `visit_root'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/haml_visitor.rb:19:in `visit'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/linter.rb:28:in `run'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:84:in `block in collect_lints'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:83:in `map'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:83:in `collect_lints'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:119:in `process_file'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:108:in `block in process_files'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:107:in `each'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:107:in `process_files'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:132:in `report'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/runner.rb:23:in `run'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/cli.rb:106:in `scan_for_lints'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/cli.rb:51:in `act_on_options'
/usr/local/bundle/gems/haml_lint-0.24.0/lib/haml_lint/cli.rb:23:in `run'
/usr/local/bundle/gems/haml_lint-0.24.0/bin/haml-lint:7:in `<top (required)>'
/usr/local/bundle/bin/haml-lint:22:in `load'
/usr/local/bundle/bin/haml-lint:22:in `<main>'
Report this bug at https://github.com/brigade/haml-lint/issues
To help fix this issue, please include:
- The above stack trace
- Haml-Lint version: 0.24.0
- Haml version: 5.0.0
- RuboCop version: 0.48.1
- Ruby version: 2.3.4
They must have changed some internal representation between the beta and release. Thanks for the report!
Would either of you be able to give us a file where this failure is happening? Feel free to sanitize the file ... as long as the failure still happens, it will help immensely!
@michaelherold I can get a similar failure with a partial that contains a single tag, e.g.
$ cat tmp/_about.html.haml
%dl
$ bundle exec haml-lint tmp/_about.html.haml
...
undefined method `each' for nil:NilClass
/Users/seanwalbran/.rvm/gems/ruby-2.2.4@socialcast/gems/haml_lint-0.24.0/lib/haml_lint/linter/class_attribute_with_static_value.rb:33:in `contains_class_attribute?'
/Users/seanwalbran/.rvm/gems/ruby-2.2.4@socialcast/gems/haml_lint-0.24.0/lib/haml_lint/linter/class_attribute_with_static_value.rb:24:in `visit_tag'
...
Report this bug at https://github.com/brigade/haml-lint/issues
To help fix this issue, please include:
- The above stack trace
- Haml-Lint version: 0.24.0
- Haml version: 5.0.0
- RuboCop version: 0.48.1
- Ruby version: 2.2.4
Well, that's unexpected! 😅
Thank you. I try to dig in over the weekend.
haml-lint fails when I execute the following command. Using haml 5.0.0.beta2, this problem does not occur.
haml-lint use Haml::Parser::ParseNode#value[:attributes_hashes] in HamlLint::Tree::Node.
cf: https://github.com/brigade/haml-lint/blob/fd0c8167eb8d4db7b18359d41127b482ee296a5a/lib/haml_lint/tree/tag_node.rb#L12 https://github.com/brigade/haml-lint/blob/fd0c8167eb8d4db7b18359d41127b482ee296a5a/lib/haml_lint/tree/node.rb#L19-L28
but, it has already deleted at https://github.com/haml/haml/commit/7c523f278a7c62eea249ea29c797bf29377e136e