Enable bare-except linter rules and fix warnings (#2988)

This commit is contained in:
correctmost 2024-12-01 02:34:51 -05:00 committed by GitHub
parent 0bc2ad700f
commit 60842bd1cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 8 additions and 11 deletions

View File

@ -1,7 +1,6 @@
[flake8] [flake8]
count = True count = True
# Several of the following could be autofixed or improved by running the code through psf/black ignore = W191,W503
ignore = E722,W191,W503
max-complexity = 40 max-complexity = 40
max-line-length = 160 max-line-length = 160
show-source = True show-source = True

View File

@ -1,5 +1,5 @@
on: [ push, pull_request ] on: [ push, pull_request ]
name: flake8 linting (3 ignores) name: flake8 linting
jobs: jobs:
flake8: flake8:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -186,7 +186,7 @@ class SysCommandWorker:
if self.child_fd: if self.child_fd:
try: try:
os.close(self.child_fd) os.close(self.child_fd)
except: except Exception:
pass pass
if self.peek_output: if self.peek_output:

View File

@ -48,7 +48,7 @@ def get_kb_layout() -> str:
"localectl --no-pager status", "localectl --no-pager status",
environment_vars={'SYSTEMD_COLORS': '0'} environment_vars={'SYSTEMD_COLORS': '0'}
).decode().splitlines() ).decode().splitlines()
except: except Exception:
return "" return ""
vcline = "" vcline = ""

View File

@ -151,7 +151,7 @@ def perform_installation(mountpoint: Path) -> None:
if chroot: if chroot:
try: try:
installation.drop_to_shell() installation.drop_to_shell()
except: except Exception:
pass pass
debug(f"Disk states after installing:\n{disk.disk_layouts()}") debug(f"Disk states after installing:\n{disk.disk_layouts()}")

View File

@ -229,7 +229,7 @@ def perform_installation(mountpoint: Path, exec_mode: ExecutionMode) -> None:
if chroot: if chroot:
try: try:
installation.drop_to_shell() installation.drop_to_shell()
except: except Exception:
pass pass
debug(f"Disk states after installing:\n{disk.disk_layouts()}") debug(f"Disk states after installing:\n{disk.disk_layouts()}")

View File

@ -794,7 +794,7 @@ class EditMenu(AbstractCurses):
self._real_input += chr(key) self._real_input += chr(key)
if self._hide_input: if self._hide_input:
key = 42 key = 42
except: except Exception:
pass pass
return key return key

View File

@ -151,7 +151,7 @@ def perform_installation(mountpoint: Path) -> None:
if chroot: if chroot:
try: try:
installation.drop_to_shell() installation.drop_to_shell()
except: except Exception:
pass pass
debug(f"Disk states after installing:\n{disk.disk_layouts()}") debug(f"Disk states after installing:\n{disk.disk_layouts()}")

View File

@ -153,7 +153,6 @@ disable = [
"C", "C",
"R", "R",
"attribute-defined-outside-init", "attribute-defined-outside-init",
"bare-except",
"broad-exception-caught", "broad-exception-caught",
"cell-var-from-loop", "cell-var-from-loop",
"dangerous-default-value", "dangerous-default-value",
@ -204,7 +203,6 @@ select = [
] ]
ignore = [ ignore = [
"E722", # bare-except
"PLC0415", # import-outside-top-level "PLC0415", # import-outside-top-level
"PLC1901", # compare-to-empty-string "PLC1901", # compare-to-empty-string
"PLW1514", # unspecified-encoding "PLW1514", # unspecified-encoding