Skip to content

Commit

Permalink
Avoid boolean-trap rules for ConfigParser get() methods (#3209)
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Feb 24, 2023
1 parent 0b7736a commit 24add5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def used(do):
mylist.index(True)
int(True)
str(int(False))
cfg.get("hello", True)
cfg.getint("hello", True)
cfg.getfloat("hello", True)
cfg.getboolean("hello", True)


class Registry:
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff/src/rules/flake8_boolean_trap/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const FUNC_CALL_NAME_ALLOWLIST: &[&str] = &[
"bytes",
"int",
"float",
"getint",
"getfloat",
"getboolean",
];

const FUNC_DEF_NAME_ALLOWLIST: &[&str] = &["__setitem__"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ expression: diagnostics
- kind:
BooleanPositionalArgInFunctionDefinition: ~
location:
row: 77
row: 81
column: 18
end_location:
row: 77
row: 81
column: 29
fix: ~
parent: ~
Expand Down

0 comments on commit 24add5f

Please sign in to comment.