diff --git a/noxfile.py b/noxfile.py index b083310..b1924fc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -223,6 +223,7 @@ def lint_code(session: nox.Session) -> None: "pep8-naming", "pydoclint[flake8]", "ruff", + "tryceratops", ) # Interpret extra arguments as `locations` of source files diff --git a/pyproject.toml b/pyproject.toml index 958b5f7..be75c51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,6 +122,7 @@ dev = [ "pep8-naming (>=0.15.1,<0.16.0)", "pydoclint[flake8] (>=0.12.0,<0.13.0)", "ruff (>=0.17.6,<0.18.0)", + "tryceratops (>=2.4.1,<3.0.0)", ] test = [ @@ -267,6 +268,8 @@ select = [ "N8", # pydoclint => Docstring matches implementation "DOC", + # tryceratops => Clean exception handling + "TRY", # ======================================== # `ruff` only (no working `flake8` plugin) # ======================================== @@ -330,6 +333,8 @@ extend-ignore = [ "SIM901", # TODOs need neither an author nor an issue. "T002", "T003", + # Messages are written where the exceptions are raised. + "TRY003", ] per-file-ignores = [ @@ -577,6 +582,8 @@ select = [ "TD", # flake8-tidy-imports ("I25") => No relative imports "TID", + # tryceratops => Clean exception handling + "TRY", # ======================================= # Violations not covered by `flake8` above # ======================================= @@ -625,6 +632,8 @@ extend-ignore = [ "RUF100", # TODOs need neither an author nor an issue. "TD002", "TD003", + # Messages are written where the exceptions are raised. + "TRY003", ] diff --git a/uv.lock b/uv.lock index 31d18b5..670d7cd 100644 --- a/uv.lock +++ b/uv.lock @@ -3826,6 +3826,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ad/66/0d785f0bc5e4315a96c989bb476d0fc07ea4f85132550c7b156ca2035d52/traitlets-5.16.1-py3-none-any.whl", hash = "sha256:f775618166caa0396c8e337099240f2bd3e5e917d203b2e6fbe21a58d3cb1f6b", size = 86211, upload-time = "2026-08-03T08:32:34.48Z" }, ] +[[package]] +name = "tryceratops" +version = "2.4.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "rich" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/2a/d3/43c2c190bb6b01decc92d87538b451d7fe8070aaaf18aa1e166bf432754e/tryceratops-2.4.1.tar.gz", hash = "sha256:fbfc14650004e27cd1e55ebb7c76b43ced04a4d3b4cbe42aac9d71e4623ed84d", size = 20595, upload-time = "2024-10-30T16:42:40.97Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/27/b5/88caeba349f17b7fd37b61bc88f81c138b3b5149b4e2a9deec66eaad1bdb/tryceratops-2.4.1-py3-none-any.whl", hash = "sha256:271b92367be89b243918a56361618607d2a9aa4aa4ba766ecfabd5f98c00480c", size = 27378, upload-time = "2024-10-30T16:42:38.914Z" }, +] + [[package]] name = "typing-extensions" version = "4.16.0" @@ -3952,6 +3965,7 @@ dev = [ { name = "pre-commit" }, { name = "pydoclint", extra = ["flake8"] }, { name = "ruff" }, + { name = "tryceratops" }, ] docs = [ { name = "sphinx" }, @@ -4030,6 +4044,7 @@ dev = [ { name = "pre-commit", specifier = ">=4.7.0,<5.0.0" }, { name = "pydoclint", extras = ["flake8"], specifier = ">=0.12.0,<0.13.0" }, { name = "ruff", specifier = ">=0.17.6,<0.18.0" }, + { name = "tryceratops", specifier = ">=2.4.1,<3.0.0" }, ] docs = [ { name = "sphinx", specifier = ">=9.2.0,<10.0.0" },