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

Support for checking construction of NamedTuple/namedtuple #10239

Open
Flamefire opened this issue Feb 20, 2025 · 0 comments
Open

Support for checking construction of NamedTuple/namedtuple #10239

Flamefire opened this issue Feb 20, 2025 · 0 comments
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs astroid update Needs an astroid update (probably a release too) before being mergable

Comments

@Flamefire
Copy link

Current problem

When using a dataclass PyLint supports unexpected-keyword-arg and no-value-for-parameter when constructing such a class

For a collections.namedtuple or typing.NamedTuple this does not trigger. See this code:

# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
from collections import namedtuple
from typing import NamedTuple

Foo = namedtuple('Foo', ('x', 'y'))


class Foo2(NamedTuple):
    x: int
    y: int


Foo(X2=1, y=2)
Foo2(X2=1, y=2)

Desired solution

For both the last lines unexpected-keyword-arg and no-value-for-parameter should be shown.

Additional context

No response

@Flamefire Flamefire added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Feb 20, 2025
@zenlyj zenlyj added False Negative 🦋 No message is emitted but something is wrong with the code Needs astroid update Needs an astroid update (probably a release too) before being mergable and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

No branches or pull requests

2 participants