Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Class variable used in class comprehension lints "used before definition." #3575

Copy link
Copy link
@rnapier

Description

@rnapier
Issue body actions

Environment data

  • VS Code version: Version 1.29.1 (1.29.1)
  • Extension version (available under the Extensions sidebar): 2018.11.0
  • OS and version: macOS 10.14.1 (18B75)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pyenv
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

Given the following code:

class C:
    EVENTS = ["x"]
    x = [(e, e) for e in EVENTS]
    y = EVENTS

The linter should discover no issues.

Actual behaviour

The use of EVENTS in the definition of x is linted as "used before definition" (use-before-def). (The definition of y does not generate a linter message.)

Steps to reproduce:

  1. Create python 3.6 file with above code.
  2. Python: Run Linting

Logs

None

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

None

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.