pylint-dev/pylint

Documentation about `class-const` needs to be updated.

duwensi-bgi opened this issue · 0 comments

Bug description

"""
Saved as file a.py.
"""

import typing
from typing import ClassVar, Final


class Test:
    """Test class."""

    WITH_CLASS_VAR_1: ClassVar = 1
    WITH_CLASS_VAR_2: typing.ClassVar = 1
    WITH_FINAL_1: Final = 1
    WITH_FINAL_2: typing.Final = 1

Configuration

# Saved as file pylintrc.
[BASIC]
class-attribute-naming-style=snake_case
class-const-naming-style=UPPER_CASE

Command used

pylint --rcfile pylintrc a.py

Pylint output

a.py:12:4: C0103: Class attribute name "WITH_CLASS_VAR_1" doesn't conform to snake_case naming style (invalid-name)
a.py:13:4: C0103: Class attribute name "WITH_CLASS_VAR_2" doesn't conform to snake_case naming style (invalid-name)

Expected behavior

According to this merged PR #4279 and the pratise above, documentation about class-const in the table of setion Additional details for v2 and v3 pylint should be:

class-const : Enum constants and class variables annotated with Final.

Currently is:

class-const : Enum constants and class variables annotated with ClassVar.

Pylint version

astroid 2.12.13
pylint 2.15.9
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32

OS / Environment

Windows 10

Additional dependencies

No response