Skip to content

False Positive: Constant name "logger" doesn't conform to UPPER_CASE naming style #2166

@Stevoisiak

Description

@Stevoisiak

Steps to reproduce

  1. Import logging in a module.
  2. Define a module-specific logger as logger.
  3. Analyze the file with pylint.
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug('debug message')

Current behavior

Pylint interprets logger as a constant and warns that it should be capitalized.

C:  3, 0: Constant name "logger" doesn't conform to UPPER_CASE naming style (invalid-name)

Expected behavior

A logger object should not be interpreted as a constant, so there should not be a warning for logger.

pylint --version output

Using config file C:\Users\svascellar\.pylintrc
pylint 1.9.0,
astroid 1.6.3
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions