Skip to content

Commit f21dbcc

Browse files
ruff: Add Pydocstyle (D) rules configuration for docstring linting
- Enabled Pydocstyle rules (D) in the `pyproject.toml` to enforce Google-style docstring conventions using Ruff. - Configured `tool.ruff.lint.pydocstyle.convention` to "google". - Applied Pydocstyle to specific file patterns like `scripts/**/*.py`, `examples/**/*.py`, and `noxfile.py`. Assisted-by: Codex
1 parent d61291f commit f21dbcc

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ extend-select = [
8484
"RSE", # raise https://docs.astral.sh/ruff/rules/#flake8-raise-rse
8585
"TRY", # tryceratops https://docs.astral.sh/ruff/rules/#tryceratops-try exception antipatterns
8686
"COM818", # prohibit trailing bare commas making tuples, see https://docs.astral.sh/ruff/rules/trailing-comma-on-bare-tuple/
87+
"D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
88+
"D417", # undocumented-param https://docs.astral.sh/ruff/rules/undocumented-param/
8789
]
8890
# Allow autofix for all enabled rules (when `--fix`) is provided.
8991
fixable = ["ALL"]
@@ -101,7 +103,20 @@ known-first-party = ["pdfrest"]
101103
"S101", # asserts allowed in tests...
102104
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
103105
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
106+
"D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
104107
]
108+
"scripts/**/*.py" = [
109+
"D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
110+
]
111+
"examples/**/*.py" = [
112+
"D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
113+
]
114+
"noxfile.py" = [
115+
"D", # pydocstyle https://docs.astral.sh/ruff/rules/#pydocstyle-d
116+
]
117+
118+
[tool.ruff.lint.pydocstyle]
119+
convention = "google" # https://docs.astral.sh/ruff/settings/#lint_pydocstyle_convention
105120

106121
[tool.tomlsort]
107122
sort_first = ["project", "build-system"]

0 commit comments

Comments
 (0)