Skip to content

False positive for UPPER_CASE variable name #3132

Closed
@lesurp

Description

@lesurp

Steps to reproduce

Code:

import random

if __name__ == "__main__":
    number = random.randint(1, 10)

Current behavior

************* Module ok
ok.py:1:0: C0114: Missing module docstring (missing-module-docstring)
ok.py:4:4: C0103: Constant name "number" doesn't conform to UPPER_CASE naming style (invalid-name)

------------------------------------------------------------------
Your code has been rated at 3.33/10 (previous run: 3.33/10, +0.00)

The second error implies number is constant, which it is not.

pylint --version output

pylint 2.4.0
astroid 2.3.0
Python 3.7.3 (default, May  9 2019, 15:28:41) 
[GCC 5.4.0 20160609]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲UsabilityIssues related to the usability/UX of pylint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions