Skip to content

Instantly share code, notes, and snippets.

@arwagner
Created October 4, 2011 20:11
Show Gist options
  • Save arwagner/1262657 to your computer and use it in GitHub Desktop.
Save arwagner/1262657 to your computer and use it in GitHub Desktop.
# 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