On Mon, Nov 1, 2010 at 3:53 PM, Reuven M. Lerner <reu...@lerner.co.il> wrote:
> Hi there. I'm working on a large Rails project using JRuby. I've
> tried to use Reek on the programs without success. I don't see
> anything in the documentation that indicates why JRuby wouldn't work
> with Reek, but when I try to run Reek on even the most trivial of
> files, I get the following error:
>
> ~/$ reek node.rb
> Error: private method `select' called for nil:NilClass
The simple answer is that I don't know. I haven't tried JRuby (yet). I
wonder whether this might be a problem with the ruby_parser gem, which
is used by Reek to convert source code into a syntax tree. So would
you trying
$ ruby_parse node.rb
and see what happens?
I notice you also raised a github ticket for this, so I'll copy this
response there too.
Has anyone else on this mailing list tried Reek with JRuby?
Many thanks,
Kevin
--
http://www.kevinrutherford.co.uk -- agile, TDD, XP, lean, TOC
You wrote:
> The simple answer is that I don't know. I haven't tried JRuby (yet).
I actually hadn't worked with JRuby until this particular project, so
you can imagine that I was also quite surprised and stumped!
> I
> wonder whether this might be a problem with the ruby_parser gem, which
> is used by Reek to convert source code into a syntax tree. So would
> you trying
>
> $ ruby_parse node.rb
>
> and see what happens?
I got a nice, long-looking parse tree:
~/LS/Projects/nlcommons/app/models$ ruby_parse node.rb
# file = node.rb loc = 329
s(:class,
:Node,
s(:colon2, s(:const, :ActiveRecord), :Base),
s(:scope,
s(:block,
s(:call,
nil,
:acts_as_tree,
s(:arglist, s(:hash, s(:lit, :order), s(:str, "name")))),
s(:call, nil, :belongs_to, s(:arglist, s(:lit, :group))),
s(:call,
nil,
etc...
When I run reek immediately afterward, I get the error I mentioned in my
original note (and the ticket):
~/LS/Projects/nlcommons/app/models$ reek node.rb
Error: private method `select' called for nil:NilClass
I've found that Reek dies on even the simplest of classes and files, so
I don't think that it's something weird that I'm doing. But hey, you
never know...
Reuven
--
Reuven M. Lerner -- Web development, consulting, and training
Mobile: +972-54-496-8405 * US phone: 847-230-9795
Skype/AIM: reuvenlerner
On Sun, Nov 7, 2010 at 2:48 PM, Reuven M. Lerner <reu...@lerner.co.il> wrote:
>
> I got a nice, long-looking parse tree:
Ok, so that eliminates ruby_parser as the source of the problem, and
therefore implies that Reek has a defect.
I'll look into it in the next few days and get back to you.
(In the meantime, if you have some spare time available to help, the
next thing I would try would be to run `rake spec` on a clone of
Reek's github project...)
Thanks,
I just installed a very basic gemset with JRuby under RVM. Now:
$ rake spec
...
673 examples, 120 failures, 1 pending
$
So not the same error as you, but still not too encouraging.
Continuing to investigate...
Cheers,
Kevin
$ echo "def y() @x = 4;end" | ruby -Ilib bin/reek
Error: private method `select' called for nil:NilClass
Cool -- onwards and upwards...
Cheers,
Kevin