seattlerb / debride

Analyze code for potentially uncalled / dead methods, now with auto-removal.
https://www.zenspider.com/projects/debride.html
720 stars 19 forks source link

Add failing test case with alias_method_chain. #7

Closed phiggins closed 9 years ago

phiggins commented 9 years ago

Like I mentioned the other day, debride fails when the file to parse has alias_method_chain in it:

pete@balloon:~/projects/debride$ cat qp.rb 
class QuarterPounder
  def royale_with_cheese
    1+1
  end

  alias_method_chain :royale, :cheese
end
pete@balloon:~/projects/debride$ ruby -Ilib -S bin/debride qp.rb --rails
These methods MIGHT not be called:
/home/pete/projects/debride/lib/debride.rb:219:in `=~': no implicit conversion of Sexp into String (TypeError)
    from /home/pete/projects/debride/lib/debride.rb:219:in `block in missing'
    from /home/pete/projects/debride/lib/debride.rb:219:in `reject!'
    from /home/pete/projects/debride/lib/debride.rb:219:in `missing'
    from /home/pete/projects/debride/lib/debride.rb:242:in `report'
    from bin/debride:5:in `<main>'

I added a failing test demonstrating the issue, but I wasn't sure what the desired behavior was.

zenspider commented 9 years ago

Merged with fix. Had to change the test to expect :royale as well, which I assume is desired.