Skip to content


Subversion checkout URL

You can clone with
Download ZIP


`annotate --exclude tests,fixtures,factories` throw exception in v2.6.0 #152

tejanium opened this Issue · 14 comments

I no longer can annotate my models with --exclude tests,fixtures,factories argument, it now throw exception in v2.6.0

$(my_gems_path)/annotate-2.6.0/bin/annotate:142:in `<top (required)>': invalid argument: --exclude tests,fixtures,factories (OptionParser::InvalidArgument)

I ran into this as well. in addition, using the shortcut -e tests,fixtures gives an error. Not sure if it's related but it could be. I'll try to look into it.

bin/annotate:123:in `block (2 levels) in <top (required)>': undefined method `each' for nil:NilClass (NoMethodError)
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1395:in `call'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1395:in `block in parse_in_order'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1351:in `catch'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1351:in `parse_in_order'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1345:in `order!'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1437:in `permute!'
from /Users/jon/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1459:in `parse!'

I'm experiencing the same issue.


Same here!

@ctran ctran was assigned

the bundle install shows Using annotate (2.6.1)
same issue here
invalid argument: --exclude tests,fixtures,factories (OptionParser::InvalidArgument)
but it works in case of using this
annotate -e tests,fixtures,factories


Looks like they've built a new version ( which has a fix merged in.

Try updating annotate and see if that doesn't fix the issues

@ctran ctran referenced this issue from a commit
Cuong Tran Handle the "--exclude" option correctly, #152 and #160 6e80ed2

Looks like the PR didn't actually fix this issue. I have a fix in the "develop" branch that I'll release soon if someone can verify that it works for you.


Weird. I just tried 2.6.1 and it looks like my fix worked if you were using the shortcut (-e) but not the full option (--exclude).

sorry about that. glad there is another fix on the way.


@bunnymatic yeah using github as source in Gemfile, had the same experience. --exclude breaks, -e works.

annotate --exclude tests,fixtures,factories -p after
/.rvm/gems/ruby-2.1.0@rails4/bundler/gems/annotate_models-eb633bcf19c6/bin/annotate:143:in `<top (required)>':    invalid argument: --exclude tests,fixtures,factories (OptionParser::InvalidArgument)
  from /.rvm/gems/ruby-2.1.0@rails4/bin/annotate:23:in `load'
  from /.rvm/gems/ruby-2.1.0@rails4/bin/annotate:23:in `<main>'
  from /.rvm/gems/ruby-2.1.0@rails4/bin/ruby_executable_hooks:15:in `eval'
 from /.rvm/gems/ruby-2.1.0@rails4/bin/ruby_executable_hooks:15:in `<main>'

How are you using github as source? Make sure to use the "develop" branch specifier.


@ctran How? gem 'annotate', :github => 'ctran/annotate_models', :branch => 'develop'

But you're right, using the develop branch fixed the --exclude error, so works for me now. Thank you!


Works for me too with the latest develop branch!


latest develop branch fixes issue for me too. :shipit:


This is a workaround for zsh

   annotate -e \[tests\] -i
@ctran ctran referenced this issue from a commit
Cuong Tran Merge branch 'release/2.6.2'
* release/2.6.2:
  Add known changes for 2.6.2.
  Retain existing position unless :force is passed
  Temporarily ignore integration tests
  Revert "Replacing old block with new one."
  Change email address
  Add .travis.yml
  switch deprecated "mock" for "double" in annotate specs
  use general file resolution for test files as well
  Replacing old block with new one.
  Fixed gemspec files attribute
  migrate.rake should live in lib/tasks
  Always load models, since they may not be autoloaded by Rails
  Handle the "--exclude" option correctly, #152 and #160
  FIX #157
  Pump version to 2.6.1 which fixes #22
@ctran ctran closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.