You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pylint 'duplicate-key' checker doesn't detect duplicate keys when said keys are enum members.
Consider the following code snippet:
fromenumimportEnum# shows that the duplicate-key checker is activated, but irrelevant for the actual issueproduces_a_warning= {"key": "value 1", "key": "value 2"}
classMyEnum(Enum):
KEY="key"does_not_produce_a_warning= {MyEnum.KEY: "value 1", MyEnum.KEY: "value 2"}
Running pylint with the default rc file generates only one warning:
duplicate_keys.py:4:21: W0109: Duplicate key 'key' in dictionary (duplicate-key)
pylint should also have detected that the dictionary does_not_produce_a_warning includes a duplicated key.
Bug description
The pylint 'duplicate-key' checker doesn't detect duplicate keys when said keys are enum members.
Consider the following code snippet:
Running pylint with the default rc file generates only one warning:
pylint should also have detected that the dictionary
does_not_produce_a_warning
includes a duplicated key.Configuration
No response
Command used
Pylint output
Expected behavior
pylint should also have detected that the dictionary
does_not_produce_a_warning
includes a duplicated key, and should have produced two warnings.Pylint version
OS / Environment
Ubuntu 20.04
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: