From 4684db3f8bfe35deaa691c8f20197d7a29334eba Mon Sep 17 00:00:00 2001 From: John Seong <39040639+sandole@users.noreply.github.com> Date: Sat, 7 Feb 2026 10:38:29 -0800 Subject: [PATCH] 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> --- .github/workflows/general-linting.yml | 1 - .pydocstyle.ini | 4 ---- ruff.toml | 32 +++++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) delete mode 100644 .pydocstyle.ini diff --git a/.github/workflows/general-linting.yml b/.github/workflows/general-linting.yml index 197925b7d02..f1e6f313030 100644 --- a/.github/workflows/general-linting.yml +++ b/.github/workflows/general-linting.yml @@ -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 diff --git a/.pydocstyle.ini b/.pydocstyle.ini deleted file mode 100644 index a81922016fb..00000000000 --- a/.pydocstyle.ini +++ /dev/null @@ -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 diff --git a/ruff.toml b/ruff.toml index 6a38e8d1d30..0c60b19b121 100644 --- a/ruff.toml +++ b/ruff.toml @@ -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"]