Skip to content

E211 fails to trigger in common cases #8379

@charliermarsh

Description

@charliermarsh

Here's a test file where E211 seems to fail

from typing import Union
import sys

from logging import Logger


def fetch_name () -> Union[str, None]:
    """Fetch name from --person-name in sys.argv.

   Returns:
        name of the person if available, otherwise None
    """
    test = len(5)
    Logger.info(test)
    # test commented code
    # Logger.info("test code")
    for i in range (0, len (sys.argv)) :
        if sys.argv[i] == "--name" :
            return sys.argv[i + 1]
    return None

ruff v0.1.3 doesn't show any errors.

Here's my ruff.toml

line-length = 88

[lint]
preview = true
select = ["E", "F", "B", "W", "I", "PL", "C90", "RUF"]
ignore = ["E203","E231"]

[mccabe]
max-complexity = 10

Originally posted by @chaitanya2692 in #3313 (comment)

Metadata

Metadata

Assignees

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