whitesmith / rubycritic

A Ruby code quality reporter
MIT License
3.36k stars 224 forks source link

reek fails #340

Closed portwood closed 4 years ago

portwood commented 4 years ago

Recently, reek (3.11) fails with a traceback:

running flay smells
..................................................................................................
running flog smells
...........................................................................................................................................................................................................................................................................................................................................................................
running reek smells
............................................................................Traceback (most recent call last):
        40: from /Users/michaelportwood/.rbenv/versions/2.6.5/bin/rubycritic:23:in `<main>'
        39: from /Users/michaelportwood/.rbenv/versions/2.6.5/bin/rubycritic:23:in `load'
        38: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/bin/rubycritic:9:in `<top (required)>'
        37: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/cli/application.rb:18:in `execute'
        36: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/commands/default.rb:17:in `execute'
        35: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/commands/default.rb:22:in `critique'
        34: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers_runner.rb:25:in `run'
        33: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers_runner.rb:25:in `each'
        32: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers_runner.rb:28:in `block in run'
        31: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers/smells/reek.rb:14:in `run'
        30: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/core/analysed_modules_collection.rb:25:in `each'
        29: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/core/analysed_modules_collection.rb:25:in `each'
        28: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers/smells/reek.rb:15:in `block in run'
        27: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers/smells/reek.rb:28:in `add_smells_to'
        26: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rubycritic-2.8.0/lib/rubycritic/analysers/smells/reek.rb:28:in `new'
        25: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/examiner.rb:36:in `initialize'
        24: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/examiner.rb:79:in `run'
        23: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        22: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        21: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:86:in `block in each'
        20: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        19: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        18: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:86:in `block in each'
        17: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        16: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:85:in `each'
        15: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:86:in `block in each'
        14: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/context/code_context.rb:84:in `each'
        13: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/examiner.rb:80:in `block in run'
        12: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/smell_repository.rb:45:in `examine'
        11: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/smell_repository.rb:45:in `each'
        10: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/smell_repository.rb:46:in `block in examine'
         9: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/smell_detector.rb:50:in `run_for'
         8: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:47:in `inspect'
         7: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:69:in `find_deepest_iterator'
         6: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:99:in `scout'
         5: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:99:in `map'
         4: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:104:in `block in scout'
         3: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:114:in `increment_depth'
         2: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:123:in `ignored_iterator?'
         1: from /Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:123:in `any?'
/Users/michaelportwood/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/reek-3.11/lib/reek/smells/nested_iterators.rb:123:in `block in ignored_iterator?': undefined method `name' for #<#<Class:0x00007ff9d4bd0828>:0x00007ff9d4bd0698> (NoMethodError)

However, the current release version of reek (5.5.0) seems to work properly. Unfortunately, Rubycritic isn't configured to work with the current version.

Rubycritic and reek give no indication as to the nature of the issue.

Rails 6.0.1.2 Ruby 2.6.5 RubyCritic 2.8.0

etagwerker commented 4 years ago

@portwood have you tried upgrading reek and rubycritic? Both versions in this issue are quite old.

nunosilva800 commented 4 years ago

This looks like an issue on reek. Try ugpgrading the gems as suggested, and if you cannot, please provide an example of a file that causes this error.