Finding Unused Production Code

How Dead Code Sticks Around

Finding Dead Code

Stats Instrumentation

ActiveSupport::Notifications.subscribe /render_partial.action_view|render_template.action_view/ do |name, start, finish, id, payload| 
  RenderTracker.track_template(name, start, finish, id, payload) unless name.include?('!') 
end

class RenderTracker
  
  def self.track_template(name, start, finish, id, payload)
    if file = payload[:identifier]
      Statsd.increment file
      Rails.logger.info "[RenderTracker] file: #{file}"
    end
    if layout = payload[:layout]
      Statsd.increment layout
      Rails.logger.info "[RenderTracker] layout: #{layout}"
    end
  end

end
      

Production Code Coverage: Coverband

Thanks

/