Created
April 3, 2013 16:52
-
-
Save jordinl-zz/5303024 to your computer and use it in GitHub Desktop.
Find unused methods in a rails projecy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ignored_dirs = "--ignore-dir=spec --ignore-dir=log --ignore-dir=tmp --ignore-dir=vendor" | |
methods = `ack --no-group --no-color #{ignored_dirs} 'def .*'`.split("\n").map { |x| x.split(/\:\s*def\s*(?:self\.)?|\s|\(/)[0..1] } | |
methods.each do |filename, method| | |
if `ack --no-group --no-color #{ignored_dirs} -w #{method}`.strip.split("\n").length == 1 | |
puts "#{filename} #{method}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment