Can I force an inspection error on duplicate function?

Is it possible to trigger an inspection error for an identical functions defined at the same scope/block level?

Here is a contrived example:

#!/usr/bin/env python

def foo(bar):
        print("1\t%s" % bar)
def foo(bar):
        print("2\t%s" % bar)
def foo(bar):
        print("3\t%s" % bar)

foo('bar')
prettyPrint();

Right now the code analysis is green and reports "no problems found".  Instead I was expecting the analysis to be yellow with a warning about the duplicated function.

If I need to submit a YouTrack for an enhancement request, please let me know.

Cheers,
Rob
4 comments
BTW, we've got a code base built up from a couple of kings of Copy/Paste.  :-(
0
At the moment PyCharm does not provide such an inspection. Feel free to file a YouTrack issue.
0
Thanks for the crazy quick reply!  I'll submit the YouTrack.
0
Below is a link to the new YouTrack — if you would find the request helpful please up-vote. :-)

http://youtrack.jetbrains.com/issue/PY-8644
0

Please sign in to leave a comment.