-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
RUF019 checks for things like "key" in dct and dct["key"] in boolean contexts, like an if condition or the argument to bool. It should also detect it as the operand of not.
$ ruff --version
ruff 0.5.1
$ echo 'bool("key" in dct and dct["key"])' | ruff check --isolated --output-format=concise --select RUF019 /dev/stdin
/dev/stdin:1:6: RUF019 [*] Unnecessary key check before dictionary access
Found 1 error.
[*] 1 fixable with the `--fix` option.
$ echo 'not ("key" in dct and dct["key"])' | ruff check --isolated --output-format=concise --select RUF019 /dev/stdin
All checks passed!Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working