-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function-redefined false positive #2410
Comments
In this example we should most likely warn about shadowing a variable with our new function. Most likely we need to adapt |
make sense |
I got the same false positive here: As mentioned above the error message is very confusing, it incorrectly states that a function was defined above. I'm not even sure this should emit an error, passing Minimal test case to reproduce:
|
@cdeil I definitely think this should trigger an error, albeit a better one than it does today. It feels cleaner to have the callback defined outside of the function, either a simple function or a staticmethod attached to the current class, and set it as a default value of the parameter, instead of having it defined in the body of the function under a condition. |
Steps to reproduce
Current behavior
************* Module sample6
/home/sussolan/git_repos/pylint/sample6.py:5:8: E0102: function already defined line 3 (function-redefined)
Your code has been rated at 6.43/10
Expected behavior
There should not be function-redefined error as originally transform_func is an argument and moreover function is defined only when the argument's value is None. Therefore function is defined only once.
pylint --version output
pylint 2.2.0
astroid 2.0.1
Python 3.6.4 (default, Jan 7 2018, 15:53:53)
[GCC 6.4.0]
The text was updated successfully, but these errors were encountered: