Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E211 fails to trigger in common cases #8379

Closed
charliermarsh opened this issue Oct 31, 2023 · 0 comments · Fixed by #8380
Closed

E211 fails to trigger in common cases #8379

charliermarsh opened this issue Oct 31, 2023 · 0 comments · Fixed by #8380
Assignees
Labels
bug Something isn't working

Comments

@charliermarsh
Copy link
Member

charliermarsh commented Oct 31, 2023

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)

@charliermarsh charliermarsh added the bug Something isn't working label Oct 31, 2023
@charliermarsh charliermarsh self-assigned this Oct 31, 2023
charliermarsh added a commit that referenced this issue Oct 31, 2023
## Summary

By using `set`, we were setting the bracket flag to `false` if another
operator was visited.

Closes #8379.

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant