-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Do not allow super()
without parameters in generator expressions
#2310
Comments
super()
without parameters in generator exmpressionssuper()
without parameters in generator expressions
Hi ! I would like to work on this issue :) |
@nasdev-cmd thank you! |
Hello, is this issue still open? |
@kitsiosvas I think that we can add this check here: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/visitors/ast/classes.py Are you familiar with python's AST? |
@sobolevn I am somewhat familiar with AST indeed. Are there any other similar checks that I could consult? |
You can take a look at this: wemake-python-styleguide/wemake_python_styleguide/visitors/ast/functions.py Lines 95 to 102 in 61d4fa5
It just checks for wrong functions. But, in this case you will also need the context. See https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/walk.py |
If I understand it correctly, I need to somehow check if super() exists as a node with parent a generator expression and it's kids |
Yes, sounds right! If
We raise a violation. |
@sobolevn Thank you for your quick reply. Edit: I am thinking of something like using |
I would go this way:
|
In order to get the node's name I would have to use |
|
I have implemented the feature. Should I issue a Pull Request for review? |
Please! 👍 |
According to the "Raise a violation" part, I tried doing something similar to #2310 (comment) , but it raises errors apparently. I couldn't figure out what is the proper way of achieving this, so far. Will keep searching, but any help is amazing. |
does this issue still exists , I want to contribute in this project , actually its my first opensource contribution , so any help regarding this really appreciated |
Can I take this issue over? |
Please! Can you also check other comprehensions? And nested functions? |
I'll do what I can. |
* Detect `super()` call being used in the wrong context. Resolves #2310. * Replace custom node tree walking code with the existing helper. * Fix incorrect class name in the line pertaining to this PR. * Fix version in the unrelated version. * Add ability to detect calls to `super()` in the nested methods. * Add missing test case.
This bug: https://bugs.python.org/issue46175
We need to require
super(cls, self)
in this case.The text was updated successfully, but these errors were encountered: