-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
(no-value-for-parameter) on dataclass field attribute C0114 #5225
Comments
Just adding my voice to this ticket to note that this also occurs in subclasses of dataclasses with default values. For example: from dataclasses import dataclass
@dataclass
class Parent:
name: str
num_children: int = 1
@dataclass
class Grandparent(Parent):
num_grandchildren: int = 1
# complains with the "no-value-for-parameter" error for num_children, num_grandchildren
grandpa = Grandparent(name="Grampy") |
Hitting this as well. The workaround I have for now is to set disable/enable blocks around the problematic code. #pylint: disable=no-value-for-parameter
grandpa = Grandparent(name="Grampy")
#pylint: enable=no-value-for-parameter |
Another example from #7059 mentionned by @suryaavala: # pylint: disable=missing-module-docstring, missing-class-docstring
from dataclasses import dataclass, field
@dataclass
class Mamal:
name: str
age: int
mamal_subgroup: str
@dataclass
class Person(Mamal):
name: str
age: int
mamal_subgroup: str = field(default="primates", init=False)
Person("John", 20) |
Related to #7291 |
I have decided to scope this to dataclasses and properties. This was indeed a false positive which I have now provided a fix for in |
Bug description
hay,
at working with dataclasses and pylint I noticed that pylint outputs a missleading error for generated attributes of dataclass.
I got E1120: No value for argument 'last_char' in constructor call (no-value-for-parameter)
Command used
Pylint output
Expected behavior
No lint error
Pylint version
The text was updated successfully, but these errors were encountered: