-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C: undefined-variableIssues related to 'undefined-variable' checkIssues related to 'undefined-variable' checkDecoratorsFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code
Description
Bug description
Since 2.6.0 pylint reports a false positive undefined-variable
warning when local decorators are used for a class inside a class.
from myconverter import Converter
class MyContainer:
CONVERTER = Converter()
@CONVERTER.register()
class NamedArray:
def __init__(self, *args, **kwargs):
pass
Configuration
No response
Command used
pylint --disable all --enable undefined-variable pylint_issue.py
Pylint output
************* Module pylint_issue_py311
pylint_issue.py:7:5: E0602: Undefined variable 'CONVERTER' (undefined-variable)
-------------------------------------------------------------------
Your code has been rated at 1.67/10 (previous run: 10.00/10, -8.33)
Expected behavior
No undefined-variable warning
Pylint version
pylint --version
pylint 2.6.0
astroid 2.5
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]
(but also can be reproduced with the latest version)
OS / Environment
ubuntu 22.04
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: undefined-variableIssues related to 'undefined-variable' checkIssues related to 'undefined-variable' checkDecoratorsFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code