Shopify/smart_todo

Crash when parsing quadruple pound

Mangara opened this issue · 1 comments

I commented out two methods with plain TODOs, like the following:

    # def change!
    #   return if already_changed?
    #   super # TODO: fix
    # end

    # def override_me(arg)
    #   super # TODO: fix
    #   self.arg_set = !!arg
    # end

This caused the smart-todo system to crash:

Traceback (most recent call last):
--
  | 15: [...]
  | 14: [...]
  | 13: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/exe/smart_todo:12:in `<top (required)>'
  | 12: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:20:in `run'
  | 11: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:20:in `each'
  | 10: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:21:in `block in run'
  | 9: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:21:in `each'
  | 8: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:22:in `block (2 levels) in run'
  | 7: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/cli.rb:70:in `parse_file'
  | 6: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/parser/comment_parser.rb:36:in `parse'
  | 5: [...]
  | 4: [...]
  | 3: [...]
  | 2: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/parser/comment_parser.rb:23:in `on_comment'
  | 1: from /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/parser/comment_parser.rb:61:in `todo_comment?'
  | /tmp/bundle/ruby/2.6.0/gems/smart_todo-1.1.0/lib/smart_todo/parser/todo_node.rb:39:in `indented_comment?': undefined method `[]' for nil:NilClass (NoMethodError)

After removing those methods, the error persisted. I suspect it's due to these types of comments now:

      #### MyModuleName