Do not use bare except (MR 2325)

A bare except catches things like ctrl+c (KeyboardInterrupt). If don't
want to catch this exception. Remove the bare except and restore the
default lint.
This commit is contained in:
Hugo Osvaldo Barrera 2024-06-23 14:25:26 +02:00 committed by Oliver Smith
parent cb4aa809e1
commit 8398bc1218
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 2 additions and 3 deletions

View file

@ -263,7 +263,7 @@ def ask_for_timezone():
if os.path.exists(tzpath):
try:
_, tz = tzpath.split(zoneinfo_path)
except:
except BaseException:
pass
if tz:
logging.info(f"Your host timezone: {tz}")

View file

@ -33,8 +33,7 @@ line-length=100
# Assume Python 3.9
target-version = "py39"
# E402: module import not on top of file, not possible for testcases
# E722: do not use bare except
lint.ignore=["E402", "E722"]
lint.ignore=["E402"]
[tool.ruff.lint.extend-per-file-ignores]
# F401: imported but unused, common for __init__.py files