Skip to content

Commit 457e790

Browse files
authoredJan 12, 2025··
Enable most flake8-bugbear rules in ruff (#3110)
1 parent 4212357 commit 457e790

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed
 

‎archinstall/lib/installer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ def _add_grub_bootloader(
11591159
config = grub_default.read_text()
11601160

11611161
kernel_parameters = ' '.join(self._get_kernel_params(root, False, False))
1162-
config = re.sub(r'(GRUB_CMDLINE_LINUX=")("\n)', rf'\1{kernel_parameters}\2', config, 1)
1162+
config = re.sub(r'(GRUB_CMDLINE_LINUX=")("\n)', rf'\1{kernel_parameters}\2', config, count=1)
11631163

11641164
grub_default.write_text(config)
11651165

‎archinstall/lib/models/mirrors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def speed(self) -> float:
6161
self._speed = size / timer.time
6262
debug(f" speed: {self._speed} ({int(self._speed / 1024 / 1024 * 100) / 100}MiB/s)")
6363
# Do not retry error
64-
except (urllib.error.URLError, ) as error:
64+
except urllib.error.URLError as error:
6565
debug(f" speed: <undetermined> ({error}), skip")
6666
self._speed = 0
6767
# Do retry error

‎archinstall/tui/curses_menu.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def get_header_entries(
114114
full_header = []
115115

116116
if header:
117-
for header in header.split('\n'):
118-
full_header += [ViewportEntry(header, cur_row, offset, STYLE.NORMAL)]
117+
for line in header.split('\n'):
118+
full_header += [ViewportEntry(line, cur_row, offset, STYLE.NORMAL)]
119119
cur_row += 1
120120

121121
return full_header

‎pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ line-length = 160
180180
[tool.ruff.lint]
181181
select = [
182182
"ASYNC", # flake8-async
183+
"B", # flake8-bugbear
183184
"C90", # mccabe
184185
"DTZ", # flake8-datetimez
185186
"E", # pycodestyle errors
@@ -206,6 +207,12 @@ select = [
206207
]
207208

208209
ignore = [
210+
"B005", # strip-with-multi-characters
211+
"B006", # mutable-argument-default
212+
"B008", # function-call-in-default-argument
213+
"B010", # set-attr-with-constant
214+
"B904", # raise-without-from-inside-except
215+
"B905", # zip-without-explicit-strict
209216
"PLC0415", # import-outside-top-level
210217
"PLC1901", # compare-to-empty-string
211218
"PLW1514", # unspecified-encoding

0 commit comments

Comments
 (0)
Please sign in to comment.