-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#1897Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergabledataclasses
Description
Bug description
hay,
at working with dataclasses and pylint I noticed that pylint outputs a missleading error for generated attributes of dataclass.
from dataclasses import dataclass, field
@dataclass
class Person:
"""
Class implementation to forecast on PRB
"""
# pylint: disable=missing-function-docstring, too-many-instance-attributes, function-redefined,
name: str
last_char: int = field(init=True)
@property
def last_char(self):
return self.name[-1]
@last_char.setter
def last_char(self, _):
pass # Do nothing, this is a read-only attribute
print(Person("Manfred"))
I got E1120: No value for argument 'last_char' in constructor call (no-value-for-parameter)
Command used
pylint ./bug-dataclasses.py
Pylint output
E1120: No value for argument 'last_char' in constructor call (no-value-for-parameter)
Expected behavior
No lint error
Pylint version
pylint 2.11.1
astroid 2.8.4
Python 3.9.5 (default, May 19 2021, 11:32:47)
[GCC 9.3.0]
Marc--Olivier
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergabledataclasses