-
Notifications
You must be signed in to change notification settings - Fork 117
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
Remove false positive error of missing member in TextChoices tuples #298
base: master
Are you sure you want to change the base?
Conversation
Why: - Test that the fields label and value are not marked as missing This change addresses the need by: - Adding a test to ensure that pylint does not mark these as errors
Pull Request Test Coverage Report for Build 1354
💛 - Coveralls |
@moritz89 test looks good to me. Are you going to work on a fix next ? |
Hi, definitely. Could you give me a pointer to how this would be implemented or where I could gather examples of how this case can be handled? |
See comments on the issue, they give enough pointers. The only other thing I can point out to is http://pylint.pycqa.org/en/latest/how_tos/transform_plugins.html |
As part of the transform, I have to call
and
Would appreciate a pointer for where I'm going wrong. The full file I'm using to apply the transform:
|
Please submit what you think is your best implementation to this PR so I can debug without having to copy & paste. One possible path is to try and suppress the |
Why: - Transform tuples to include value and label properties This change addresses the need by: - Adding the text_choices transform file - Integrating in the transforms init file - Focusing on the predicate for the rule to trigger the transform
Hi Alexander, I pushed the code with which I try to trigger the transform in the test class. The trouble I have is that during the parsing process I never seem to land in the test file itself |
From what I can tell this is because you are triggerring the AST transform on a
Now In Django you have this signature This is how what you declare as a tuple gets a I'm not quite sure what the rest of your code does and why. You check for assign nodes, classdef, funcdef but I fail to see the idea behind. The code being not complete doesn't help either. I did experiment with the following snippet:
It will trigger the transform function when the class in question inherits from I have some examples in this old talk - https://www.youtube.com/watch?v=3CkSKUNMLJc&list=PLFjlI7p-h1hxBP3cIjEqePSeoBDHud5Db&index=47&t=328s (after 40:00). IIRC I took them directly from pylint's own source code. Hope this helps. |
aa6c7ee
to
054b49a
Compare
Why:
This change addresses the need by: