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

class method 'inherited' reported, even if it would be called #21

Closed recursive-madman closed 9 years ago

recursive-madman commented 9 years ago

Given this input file:

class A
  def self.inherited(base)
    puts "#{base.name} inherits from #{name}"
  end
end

class B < A
end

it can be verified, that the inherited method is actually called (as expected):

$ ruby try-inherit.rb 
B inherits from A

however, debride complains about it:

$ debride try-inherit.rb
These methods MIGHT not be called:

A
  inherited                           try-inherit.rb:2
zenspider commented 9 years ago

Yup. That's how debride works. You didn't analyze any code that calls that method, so it reports it as potentially dead. Add it to a whitelist to remove it from the report.