Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace darglint with Ruff's pydoclint preview rules #372

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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
Expand All @@ -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"

Expand Down
9 changes: 0 additions & 9 deletions setup.cfg

This file was deleted.

6 changes: 3 additions & 3 deletions src/biip/upc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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."""
Expand Down
Loading