Skip to content

Commit

Permalink
Enable most flake8-bugbear rules in ruff (#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost authored Jan 12, 2025
1 parent 4212357 commit 457e790
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ def _add_grub_bootloader(
config = grub_default.read_text()

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

grub_default.write_text(config)

Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/models/mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def speed(self) -> float:
self._speed = size / timer.time
debug(f" speed: {self._speed} ({int(self._speed / 1024 / 1024 * 100) / 100}MiB/s)")
# Do not retry error
except (urllib.error.URLError, ) as error:
except urllib.error.URLError as error:
debug(f" speed: <undetermined> ({error}), skip")
self._speed = 0
# Do retry error
Expand Down
4 changes: 2 additions & 2 deletions archinstall/tui/curses_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def get_header_entries(
full_header = []

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

return full_header
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ line-length = 160
[tool.ruff.lint]
select = [
"ASYNC", # flake8-async
"B", # flake8-bugbear
"C90", # mccabe
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
Expand All @@ -206,6 +207,12 @@ select = [
]

ignore = [
"B005", # strip-with-multi-characters
"B006", # mutable-argument-default
"B008", # function-call-in-default-argument
"B010", # set-attr-with-constant
"B904", # raise-without-from-inside-except
"B905", # zip-without-explicit-strict
"PLC0415", # import-outside-top-level
"PLC1901", # compare-to-empty-string
"PLW1514", # unspecified-encoding
Expand Down

0 comments on commit 457e790

Please sign in to comment.