Skip to content

invalid-name match for a valid name in exceptΒ #10652

@korhojoa

Description

@korhojoa

Bug description

C0103: Variable name "VERSION" doesn't conform to snake_case naming style (invalid-name)
This reproduces:


from importlib.metadata import PackageNotFoundError
from importlib.metadata import version

try:
    VERSION = version("ty")
except PackageNotFoundError:
    VERSION = "0.0.0"


3.3.9 does not match this.

Configuration

[tool.pylint.format]
max-line-length = 120

[tool.pylint.basic]
good-names = ["i", "j", "k", "ex", "Run", "_", "f", "dn"]
extension-pkg-whitelist = ["lxml.etree", "pydantic"]

[tool.pylint."messages control"]
disable = [
    "raw-checker-failed",
    "locally-disabled",
    "suppressed-message",
    "wrong-import-order",
    "ungrouped-imports",
]

[tool.pylint.design]
max-args = 8
max-positional-arguments = 8
max-attributes = 10
min-public-methods = 0

Command used

pylint a

Pylint output

************* Module a
a/__init__.py:9:4: C0103: Variable name "VERSION" doesn't conform to snake_case naming style (invalid-name)

Expected behavior

No output.

Pylint version

pylint 4.0.0
astroid 4.0.1
Python 3.11.12 (main, May  8 2025, 08:02:37) [GCC 13.3.0]

OS / Environment

No response

Additional dependencies

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions