Skip to content

Ruff does not signal E999 SyntaxError on literal assignment. #6895

@0x6d6e647a

Description

@0x6d6e647a

I'm using Ruff v0.0.286 in the following.

For the following Python code:

#!/usr/bin/env python
5 = 3

No output is generated from ruff when analyzed:

user@host $ ruff literal_assign.py

When run from Python:

user@host $ python literal_assign.py
  File "/home/user/literal_assign.py", line 2
    5 = 3
    ^
SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?

When analyzed with flake8:

user@host $ flake8 literal_assign.py
literal_assign.py:2:2: E999 SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions