diff --git a/pygitweb/git_helpers.py b/pygitweb/git_helpers.py
index 84f0ed7..34a0520 100644
--- a/pygitweb/git_helpers.py
+++ b/pygitweb/git_helpers.py
@@ -11,6 +11,7 @@ from __future__ import annotations
 
 import os
 import re
+from contextlib import suppress
 from typing import Any
 
 import pygit2
@@ -490,10 +491,8 @@ def get_commits_in_range(project: str, tip: str, base: str | None) -> list[str]:
 		tip_commit = repo.revparse_single(tip).peel(pygit2.Commit)
 		walker = repo.walk(tip_commit.id, pygit2.GIT_SORT_TIME | pygit2.GIT_SORT_TOPOLOGICAL)
 		if base:
-			try:
+			with suppress(KeyError, pygit2.GitError, ValueError):
 				walker.hide(repo.revparse_single(base).peel(pygit2.Commit).id)
-			except (KeyError, pygit2.GitError, ValueError):
-				pass
 		return [str(c.id) for c in walker]
 	except (KeyError, pygit2.GitError, OSError, ValueError):
 		return []
diff --git a/pygitweb/main.py b/pygitweb/main.py
index 81368a7..db98359 100644
--- a/pygitweb/main.py
+++ b/pygitweb/main.py
@@ -7,6 +7,7 @@ from __future__ import annotations
 
 import os
 import subprocess
+from contextlib import suppress
 import tempfile
 import zipfile
 from pathlib import Path
@@ -402,14 +403,12 @@ async def addproject_submit(
 			pygit2.init_repository(dest_path, bare=True)
 
 		if do_maintenance:
-			try:
+			with suppress(subprocess.SubprocessError, FileNotFoundError):
 				subprocess.run(
 					[config.GIT, "-C", dest_path, "maintenance", "start"],
 					capture_output=True,
 					timeout=60,
 				)
-			except (subprocess.SubprocessError, FileNotFoundError):
-				pass  # best-effort
 
 		if do_task_board:
 			pass  # stub
diff --git a/pygitweb/settings.py b/pygitweb/settings.py
index b214cb0..ce30a88 100644
--- a/pygitweb/settings.py
+++ b/pygitweb/settings.py
@@ -5,6 +5,7 @@ Forms are generated from type() and docstrings; project config shows only LOCAL/
 
 from __future__ import annotations
 
+from contextlib import suppress
 from typing import Any
 from urllib.parse import quote
 
@@ -459,10 +460,8 @@ async def settings_project_submit(request: Request, name: str):
 	indices = set()
 	for form_key in form:
 		if form_key.startswith("config_key_"):
-			try:
+			with suppress(ValueError):
 				indices.add(int(form_key.split("_")[-1]))
-			except ValueError:
-				pass
 	pairs = []
 	for i in sorted(indices):
 		k = (form.get(f"config_key_{i}") or "").strip()
