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

E1120: no-value-for-parameter does not respect init=False in field in dataclasses #7059

Closed
suryaavala opened this issue Jun 26, 2022 · 1 comment
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@suryaavala
Copy link

suryaavala commented Jun 26, 2022

Bug description

add the following to lint.py

# 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)

Configuration

[tool.pylint.messages_control]
max-line-length = 140
disable=["fixme", "too-few-public-methods","invalid-name", "useless-return"]

Command used

pylint lint.py

Pylint output

************* Module lint
lint.py:19:0: E1120: No value for argument 'mamal_subgroup' in constructor call (no-value-for-parameter)

Expected behavior

Pylint version

pylint 2.14.1
astroid 2.11.5
Python 3.8.13 (default, Mar 16 2022, 20:38:07) 
[Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

macos(12.3.1)

@suryaavala suryaavala added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 26, 2022
@Pierre-Sassoulas
Copy link
Member

Thank you for opening an issue. It does look like a duplicate of #5225 so I'm going to keep the previous one.

@Pierre-Sassoulas Pierre-Sassoulas added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants