annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

TypeError: no implicit conversion of Array into String when using --additional-file-patterns

Open jimmynguyc opened this issue 5 years ago • 1 comments

Commands

$ annotate --additional-file-patterns whatever-you-put-here
TypeError: no implicit conversion of Array into String
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/annotate-3.1.1/lib/annotate/parser.rb:59:in `[]='
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/annotate-3.1.1/lib/annotate/parser.rb:59:in `block in add_options_to_parser'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1582:in `block in parse_in_order'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1568:in `catch'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1568:in `parse_in_order'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1562:in `order!'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1656:in `permute!'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/optparse.rb:1678:in `parse!'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/annotate-3.1.1/lib/annotate/parser.rb:30:in `parse'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/annotate-3.1.1/lib/annotate/parser.rb:7:in `parse'
  /Users/jimmy/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/annotate-3.1.1/bin/annotate:22:in `<top (required)>'
  /Users/jimmy/.rbenv/versions/2.6.6/bin/annotate:23:in `load'
  /Users/jimmy/.rbenv/versions/2.6.6/bin/annotate:23:in `<top (required)>'

https://github.com/ctran/annotate_models/blob/407ace641c637567372c98f32a6af10bbb1bc901/lib/annotate/parser.rb#L56-L60

I believe saving an array into the ENV variable on line 59 is causing the issue.

Version

  • annotate version 3.1.1
  • rails version 6.0.2.2
  • ruby version ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]

jimmynguyc avatar May 03 '20 11:05 jimmynguyc

My immediate suspicion is that line 59 should read env['additional_file_patterns'] = additional_file_patterns not ENV[...]. This is how all the other option_parser.on ... end blocks are now written in the parser.rb file before the env hash gets passed to the commit method. Looks like this might be a simple fix?

It looks like this may have gotten left out of this refactor of the parser? @drwl might be able to diagnose this quickly if that's the case!

twwright avatar May 17 '20 04:05 twwright