Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Add pydocstyle/flake8-docstrings rules to ruff.

Andrey Rakhmatullind6bf1464b875
diff --git a/pyproject.toml b/pyproject.toml
index 9d88b4e80..41ba77094 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -240,6 +240,8 @@ extend-select = [
"B",
# flake8-comprehensions
"C4",
+ # pydocstyle
+ "D",
# flake8-debugger
"T10",
]
@@ -260,6 +262,38 @@ ignore = [
"B028",
# Within an `except` clause, raise exceptions with `raise ... from`
"B904",
+ # Missing docstring in public module
+ "D100",
+ # Missing docstring in public class
+ "D101",
+ # Missing docstring in public method
+ "D102",
+ # Missing docstring in public function
+ "D103",
+ # Missing docstring in public package
+ "D104",
+ # Missing docstring in magic method
+ "D105",
+ # Missing docstring in public nested class
+ "D106",
+ # Missing docstring in __init__
+ "D107",
+ # One-line docstring should fit on one line with quotes
+ "D200",
+ # No blank lines allowed after function docstring
+ "D202",
+ # 1 blank line required between summary line and description
+ "D205",
+ # Multi-line docstring closing quotes should be on a separate line
+ "D209",
+ # First line should end with a period
+ "D400",
+ # First line should be in imperative mood; try rephrasing
+ "D401",
+ # First line should not be the function's "signature"
+ "D402",
+ # First word of the first line should be properly capitalized
+ "D403",
]
[tool.ruff.lint.per-file-ignores]
@@ -276,3 +310,6 @@ ignore = [
"scrapy/utils/url.py" = ["F403", "F405"]
"tests/CrawlerRunner/change_reactor.py" = ["E402"]
"tests/test_loader.py" = ["E741"]
+
+[tool.ruff.lint.pydocstyle]
+convention = "pep257"