troessner / reek

Code smell detector for Ruby
https://github.com/troessner/reek
MIT License
4.05k stars 280 forks source link

Getting "`inspect': undefined method `name' for s(:str, "SuccessResult")" in 4.1.0. #964

Closed y-yagi closed 8 years ago

y-yagi commented 8 years ago

Hi.

After the upgrade from 4.0.2 to 4.1.0, "inspect': undefined methodname' for s(:str, "SuccessResult")" has occurred.

Stack trace is following:

$HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/smells/subclassed_from_core_class.rb:34:in `inspect': undefined method `name' for s(:str, "SuccessResult"):#<Class:0x0055ee843368c8> (NoMethodError)
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/smells/smell_detector.rb:47:in `run_for'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/smells/smell_repository.rb:47:in `block in examine'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/smells/smell_repository.rb:46:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/smells/smell_repository.rb:46:in `examine'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/examiner.rb:81:in `block in run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:85:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:87:in `block in each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:86:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:86:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:87:in `block in each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:86:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/context/code_context.rb:86:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/examiner.rb:80:in `run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/reek-4.1.0/lib/reek/examiner.rb:37:in `initialize'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers/smells/reek.rb:28:in `new'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers/smells/reek.rb:28:in `add_smells_to'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers/smells/reek.rb:15:in `block in run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/core/analysed_modules_collection.rb:25:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/core/analysed_modules_collection.rb:25:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers/smells/reek.rb:14:in `run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers_runner.rb:28:in `block in run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers_runner.rb:25:in `each'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/analysers_runner.rb:25:in `run'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/commands/default.rb:22:in `critique'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/commands/default.rb:17:in `execute'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/lib/rubycritic/cli/application.rb:18:in `execute'
    from $HOME/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubycritic-2.9.2/bin/rubycritic:9:in `<top (required)>'
    from $HOME/.rbenv/versions/2.2.3/bin/rubycritic:23:in `load'
    from $HOME/.rbenv/versions/2.2.3/bin/rubycritic:23:in `<main>'

Do I need something for upgrade? Thanks.

troessner commented 8 years ago

Can you identify and share the offending piece of code?

mvz commented 8 years ago

I'm guessing it's SomeConstant = Struct.new('SuccessResult').