Skip to content
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

Support Enum with self defined members #5138

Closed
OldIMP opened this issue Oct 10, 2021 · 1 comment · Fixed by #5847
Closed

Support Enum with self defined members #5138

OldIMP opened this issue Oct 10, 2021 · 1 comment · Fixed by #5847
Labels
Enhancement ✨ Improvement to a component False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@OldIMP
Copy link

OldIMP commented Oct 10, 2021

Current problem

False positive E1101 are reported for self defined member in Enums.

Example:

  • Enum Layout w/ self defined members col & row
  • Here will then be reported falsely as E1101:

    r_quiz.py:174:12: E1101: Instance of 'SIMPLE' has no 'row' member (no-member)
    r_quiz.py:174:12: E1101: Instance of 'SCHRIFTLICH' has no 'row' member (no-member)
    r_quiz.py:174:25: E1101: Instance of 'SIMPLE' has no 'col' member (no-member)
    r_quiz.py:174:25: E1101: Instance of 'SCHRIFTLICH' has no 'col' member (no-member)

pylint --version

pylint 2.11.1
astroid 2.8.2
Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)]

Desired solution

According to Python doc, self defined members in Enums are allowed. Therefore no issues should be reported for the example above.

Additional context

No response

@OldIMP OldIMP added Enhancement ✨ Improvement to a component Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 10, 2021
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 11, 2021
@marianhlavac
Copy link

Any progress on this?

huwcbjones added a commit to huwcbjones/pylint that referenced this issue Feb 27, 2022
Add _enum_has_attribute to typechecker to parse AST and find attribute assignments
in __new__.
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.0 milestone Feb 27, 2022
huwcbjones added a commit to huwcbjones/pylint that referenced this issue Mar 6, 2022
Add _enum_has_attribute to typechecker to parse AST and find attribute assignments
in __new__.
huwcbjones added a commit to huwcbjones/pylint that referenced this issue May 1, 2022
Add _enum_has_attribute to typechecker to parse AST and find attribute assignments
in __new__.
huwcbjones added a commit to huwcbjones/pylint that referenced this issue May 4, 2022
Add _enum_has_attribute to typechecker to parse AST and find attribute assignments
in __new__.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants