Created
October 4, 2011 20:11
-
-
Save arwagner/1262657 to your computer and use it in GitHub Desktop.
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
# reek does this at the top level somewhere | |
# (which means you could define your own smell at the top level somewhere too) | |
smell :duplication do |code| | |
code.methods.where do |method| | |
method.method_calls.where do |call| | |
method.method_calls.where do |call2| | |
call2 == call | |
end.count > 1 | |
end.count > 1 | |
end | |
end | |
end | |
end | |
# then in my client app, i do this: | |
for_smell :duplication do |smell| | |
smell.where(method.name != :method_in_which_to_ignore_duplication) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment