Pylint rules for dataclass attributes

Viewed 22

I have a question about how pylint (2.13.9) treats naming rules in the context of dataclasses. For example, in my .pylintrc I defined that class-attribute-naming-style = UPPER_CASE and attr-naming-style = snake_case.

However, that results in the following correct naming is flagged as wrong, since name is not in upper case, although it will be a object attribute and not a class attribute.

@dataclass
class DataClass:
    name: str

This seems to me like a very typical case but I could not find any information on how to handle this best (only some closed pylint issues that report this problem to be closed).

Of course, I can add a # pylint: disable=C0103 to every line where I define a dataclass attribute, but that does not seem like the proper way to do it. Is there another global rule or setting I should use to handle this kind of check?

0 Answers
Related