diff --git a/pyproject.toml b/pyproject.toml index 001fe99..f04af08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,9 @@ Repository = "https://github.com/jodal/biip" Documentation = "https://biip.readthedocs.io" [dependency-groups] -darglint = ["darglint>=1.8.1"] dev = [ "tox>=4.21.2", "tox-uv>=1.23.2", - { include-group = "darglint" }, { include-group = "docs" }, { include-group = "mypy" }, { include-group = "pyright" }, @@ -95,7 +93,18 @@ reportPrivateUsage = false target-version = "py39" [tool.ruff.lint] -select = ["ALL"] +preview = true +explicit-preview-rules = true +select = [ + "ALL", + # + # Preview rules + "DOC201", # docstring-missing-returns + "DOC202", # docstring-extraneous-returns + "DOC402", # docstring-missing-yields + "DOC403", # docstring-extraneous-yields + "DOC501", # docstring-missing-exception +] ignore = [ "PLR2004", # magic-value-comparison "S101", # assert @@ -121,6 +130,9 @@ ignore = [ [tool.ruff.lint.isort] known-first-party = ["biip"] +[tool.ruff.lint.pydoclint] +ignore-one-line-docstrings = true + [tool.ruff.lint.pydocstyle] convention = "google" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 31e8f74..0000000 --- a/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[darglint] -ignore = - # DAR402: Excess exceptions in Raises section - # (we know they are raised from called function) - DAR402 -ignore_raise = - # Exception is used for cases that are bugs and should never happen. - Exception -strictness = short diff --git a/src/biip/upc.py b/src/biip/upc.py index d4caf66..e3c672f 100644 --- a/src/biip/upc.py +++ b/src/biip/upc.py @@ -126,7 +126,7 @@ def parse(cls, value: str) -> Upc: return cls._parse_upc_e(value) msg = "Unhandled UPC length. This is a bug." # pragma: no cover - raise Exception(msg) # noqa: TRY002 # pragma: no cover + raise NotImplementedError(msg) # pragma: no cover @classmethod def _parse_upc_a(cls, value: str) -> Upc: @@ -222,7 +222,7 @@ def as_upc_a(self) -> str: msg = ( # pragma: no cover "Unhandled case while formatting as UPC-A. This is a bug." ) - raise Exception(msg) # noqa: TRY002 # pragma: no cover + raise NotImplementedError(msg) # pragma: no cover def as_upc_e(self) -> str: """Format as UPC-E. @@ -245,7 +245,7 @@ def as_upc_e(self) -> str: msg = ( # pragma: no cover "Unhandled case while formatting as UPC-E. This is a bug." ) - raise Exception(msg) # noqa: TRY002 # pragma: no cover + raise NotImplementedError(msg) # pragma: no cover def as_gtin_12(self) -> str: """Format as GTIN-12."""