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]
count = True
# Several of the following could be autofixed or improved by running the code through psf/black
ignore = E722,W191,W503
ignore = W191,W503
max-complexity = 40
max-line-length = 160
show-source = True

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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