chore(lint): migrate from pydocstyle to ruff (#7346)

pydocstyle has been deprecated and archived (Nov 2023). The maintainers
recommend migrating to Ruff, which has full parity with pydocstyle.

Changes:
- Add "D" (pydocstyle) rules to ruff.toml select list
- Migrate ignore rules from .pydocstyle.ini to ruff.toml
- Remove pydocstyle from CI workflow
- Delete .pydocstyle.ini

This also fixes false positives like D402 being triggered incorrectly
when a method named `name` has a docstring containing "name" anywhere.

See: https://github.com/PyCQA/pydocstyle (archived)

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
This commit is contained in:
John Seong
2026-02-07 10:38:29 -08:00
committed by GitHub
parent 117dc73c86
commit 4684db3f8b
3 changed files with 30 additions and 7 deletions

View File

@@ -66,7 +66,6 @@ jobs:
if [ -n "${{ env.diff_files }}" ]; then
black --diff --check ${{ env.diff_files }}
mypy ${{ env.diff_files }} --ignore-missing-imports --scripts-are-modules --check-untyped-defs
pydocstyle ${{ env.diff_files }}
pylint ${{ env.diff_files }}
ruff check ${{ env.diff_files }}
else

4
.pydocstyle.ini vendored
View File

@@ -1,4 +0,0 @@
[pydocstyle]
inherit = True
ignore = D202,D203,D205,D210,D212,D213,D214,D215,D400,D404,D405,D406,D407,D408,D409,D410,D411,D413,D415,D416,D417
match = .*\.py

32
ruff.toml vendored
View File

@@ -14,6 +14,7 @@ fix = true
[lint]
select = [
"D",
"E",
"W",
"F",
@@ -28,8 +29,35 @@ select = [
"SIM",
"T20",
]
# These ignores should be seen as temporary solutions to problems that will NEED fixed
ignore = ["PLR2004", "PLR0913", "PLR0915", "PLC0415", "E402"]
ignore = [
"PLR2004", # magic-value-comparison
"PLR0913", # too-many-arguments
"PLR0915", # too-many-statements
"PLC0415", # import-outside-top-level
"E402", # module-import-not-at-top-of-file
# Docstring style choices (migrated from .pydocstyle.ini)
"D202", # no-blank-line-after-function
"D203", # one-blank-line-before-class
"D205", # blank-line-after-summary
"D210", # surrounding-whitespace
"D212", # multi-line-summary-first-line
"D213", # multi-line-summary-second-line
"D214", # section-not-over-indented
"D215", # section-underline-not-over-indented
"D400", # ends-in-period
"D404", # docstring-starts-with-this
"D405", # capitalize-section-name
"D406", # new-line-after-section-name
"D407", # dashed-underline-after-section
"D408", # section-underline-after-name
"D409", # section-underline-matches-section-length
"D410", # no-blank-line-after-section
"D411", # no-blank-line-before-section
"D413", # blank-line-after-last-section
"D415", # ends-in-punctuation
"D416", # section-name-ends-in-colon
"D417", # undocumented-param
]
[lint.per-file-ignores]
"**/tests/*" = ["S101"]