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

too-many-instance-attributes counts InitVars #3794

Closed
p4l1ly opened this issue Aug 25, 2020 · 0 comments · Fixed by pylint-dev/astroid#1126
Closed

too-many-instance-attributes counts InitVars #3794

p4l1ly opened this issue Aug 25, 2020 · 0 comments · Fixed by pylint-dev/astroid#1126
Labels
Enhancement ✨ Improvement to a component

Comments

@p4l1ly
Copy link

p4l1ly commented Aug 25, 2020

Steps to reproduce

  1. create a file example.py
"Module docstring"

from dataclasses import dataclass, InitVar

@dataclass
class Hello:
    "Class docstring"

    a_1: int
    a_2: int
    a_3: int
    a_4: int
    a_5: int
    a_6: int
    a_7: int
    a_8: InitVar[int]

    def __post_init__(self, a_8):
        self.a_7 += a_8
  1. Run pylint --reports no --persistent no example

Current behavior

too-many-instance-attributes (8/7) are reported but a_8 is not an instance attribute so it should not be counted.

Expected behavior

pylint should report no error.

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.8.2 (default, Apr  8 2020, 14:31:25)
[GCC 9.3.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants