-
-
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
Disable too-few-public-methods for attrs. #2988
Comments
Hey @Beefy-Swain Thanks for the report, this now should be fixed in |
The error still exists with pylint version 2.17.0 and attrs version 23.1.0 Code: """ Module description. """
from attrs import define, field, frozen
from attrs.validators import instance_of
@define
class Bar:
""" Class description. """
field: int = field(validator=instance_of(int))
@frozen
class Foo:
""" Class description. """
field: int = field(validator=instance_of(int))
print(Bar(5))
print(Foo(7)) Output:
|
akirchhoff-modular
added a commit
to akirchhoff-modular/pylint
that referenced
this issue
Jan 4, 2024
Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (pylint-dev#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes pylint-dev#9345.
jacobtylerwalls
pushed a commit
that referenced
this issue
May 4, 2024
…9346) Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes #9345.
github-actions bot
pushed a commit
that referenced
this issue
May 4, 2024
…9346) Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes #9345. (cherry picked from commit c032181)
jacobtylerwalls
pushed a commit
that referenced
this issue
May 4, 2024
…9346) (#9596) Beginning with attrs 21.1.0, the recommended way to use attrs is through `import attrs` and using `attrs.define`/`attrs.frozen`, not `import attr` and `attr.s` or `attr.attrs`. Pylint does understand `attr.attrs` (#2988), but new-style uses of attrs are not understood to be data class decorators. Modify `_is_exempt_from_public_methods` to recognize `attrs.define` and `attrs.frozen` in a similar way as is currently done with `dataclasses.dataclass`. Closes #9345. (cherry picked from commit c032181) Co-authored-by: akirchhoff-modular <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe
Dataclasses, and some similar types of classes disable the
too-few-public-methods
check, but attrs does not. In addition there is not any way to specify types of classes to automatically ignored for those types of checks.Describe the solution you'd like
Attrs should probably by default disable
too-few-public-methods
.Another potential option is to allow the user to specify decorators in the pylintcr that should disable certain checks.
Additional context
I def could just be dumb and unaware of the solution to this problem, but I did google around a lot, and read through
design_analysis.py
to no avail.The text was updated successfully, but these errors were encountered: