DTS requires a linter for docstrings but the current selection is
limited. The most promising docstring linter is pydoclint.
On the other hand, Ruff is currently in the process of implementing
pydoclint rules. This would spare the project from supporting yet
another linter, without any loss of benefit.

This commit enables a selection of pydoclint rules in Ruff, which while
still in preview they are already capable of aiding the process.

DOC201 was omitted because it currently does not support one-line
docstrings, trying to enforce full ones even when not needed.

DOC502 was omitted because it complains for exceptions that were
reported but not present in the body of the function. While treating
documented exceptions when they appear to not be raised as an error
is a sound argument, it currently doesn't work well with inherited
class methods, which parent does raise exceptions.

Bugzilla ID: 1455

Signed-off-by: Luca Vizzarro <luca.vizza...@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepa...@arm.com>
---
 dts/pyproject.toml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dts/pyproject.toml b/dts/pyproject.toml
index 3436d82116..2658a3d22c 100644
--- a/dts/pyproject.toml
+++ b/dts/pyproject.toml
@@ -65,7 +65,11 @@ select = [
     "D",      # pydocstyle
     "C90",    # mccabe
     "I",      # isort
+    # pydoclint
+    "DOC202", "DOC402", "DOC403", "DOC501"
 ]
+preview = true # enable to get early access to pydoclint rules
+explicit-preview-rules = true # enable ONLY the explicitly selected preview 
rules
 
 [tool.ruff.lint.pydocstyle]
 convention = "google"
-- 
2.43.0

Reply via email to