Skip to content

Pylint false report for used-before-assignment #9134

Open
@matejsp

Description

@matejsp

Bug description

import typing

from marshmallow import fields
from marshmallow import validate


class AdminCancelOrders:
    order_ids: typing.List[int] = fields.List(fields.Int(), required=True, validate=validate.Length(min=1))

    def validate(self):
        pass

Configuration

No response

Command used

pylint pylint_bug_test.py

Pylint output

pylint pylint_bug_test.py
************* Module pylint_bug_test
pylint_bug_test.py:8:84: E0601: Using variable 'validate' before assignment (used-before-assignment)

Expected behavior

It should report that validate is used before assignement as it did not in 2.7.x

Pylint version

pylint 3.0.1
astroid 3.0.0
Python 3.11.2 (main, Mar 10 2023, 07:05:07) [Clang 14.0.0 (clang-1400.0.29.202

OS / Environment

MacOSX Ventura

Additional dependencies

marshmallow==2.21.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: used-before-assignmentIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions