Skip to content

Commit cd1ff8a

Browse files
László Vaskóvlaci
authored andcommitted
chore(lint): enable flake8-boolean-trap ruff rules
- FBT001: Boolean positional arg in function definition - FBT002: Boolean default value in function definition - FBT003: Boolean positional value in function call https://beta.ruff.rs/docs/rules/#flake8-boolean-trap-fbt
1 parent 32b799e commit cd1ff8a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ select = [
6868
"D", # pydocstyle
6969
"E", # pycodestyle (errors)
7070
"F", # pyflakes
71+
"FBT", # flake8-boolean-trap
7172
"I", # isort
7273
"ISC", # flake8-implicit-str-concats
7374
"N", # pep8-naming
@@ -108,6 +109,10 @@ ignore-init-module-imports = true
108109
"build.py" = [
109110
"T201" # print
110111
]
112+
"tests/*" = [
113+
"FBT001", # boolean-positional-arg-in-function-definition: allowed in `pytest.param()`
114+
"FBT003", # boolean-positional-value-in-function-call: allowed test parameters
115+
]
111116

112117
[tool.ruff.flake8-comprehensions]
113118
allow-dict-calls-with-keyword-arguments = true # code like `dict(a=1, b=2)` is allowed

unblob/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
def show_external_dependencies(
29-
ctx: click.Context, _param: click.Option, value: bool
29+
ctx: click.Context, _param: click.Option, value: bool # noqa: FBT001
3030
) -> None:
3131
if not value or ctx.resilient_parsing:
3232
return
@@ -179,13 +179,13 @@ def cli(
179179
file: Path,
180180
extract_root: Path,
181181
report_file: Optional[Path],
182-
force: bool,
182+
force: bool, # noqa: FBT001
183183
process_num: int,
184184
depth: int,
185185
entropy_depth: int,
186186
skip_magic: Iterable[str],
187-
skip_extraction: bool,
188-
keep_extracted_chunks: bool,
187+
skip_extraction: bool, # noqa: FBT001
188+
keep_extracted_chunks: bool, # noqa: FBT001
189189
handlers: Handlers,
190190
plugins_path: Optional[Path],
191191
plugin_manager: UnblobPluginManager,

unblob/handlers/archive/_safe_tarfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313

1414
class SafeTarFile(TarFile):
15-
def extract(self, member, path="", set_attrs=True, *, numeric_owner=False):
15+
def extract(
16+
self, member, path="", set_attrs=True, *, numeric_owner=False # noqa: FBT002
17+
):
1618
path_as_path = Path(str(path))
1719
member_name_path = Path(str(member.name))
1820

0 commit comments

Comments
 (0)