Skip to content

chore: add docstring formatting + linting - #1567

Open
WilliamBergamin wants to merge 4 commits into
mainfrom
docstring-formatting
Open

chore: add docstring formatting + linting#1567
WilliamBergamin wants to merge 4 commits into
mainfrom
docstring-formatting

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds docstring formatting + linting via Ruff's pydocstyle (D) rules, fixing violations rather than suppressing them.

Config (pyproject.toml):

  • select = ["E", "W", "F", "D"] with [tool.ruff.lint.pydocstyle] convention = "google".
  • The only D rules ignored are the missing-docstring ones (D100D107)
    • so we do not add docstrings where none exist. Every other D rule fires only on existing docstrings.
  • [tool.ruff.format] docstring-code-format = true (forward-looking; no-op on current code).

Fixes:

  • D205 blank line after summary, D415 terminal punctuation, D417 undocumented params, plus safe structural fixes (D212, D209, D202, etc.).
  • Sync/async docstring pairs updated symmetrically (e.g. step.py/async_step.py, request_verification.py/async_request_verification.py).
  • No # noqa or per-file-ignores added.

Scripts / CI gate:

  • scripts/format.sh now formats examples/ too.
  • scripts/lint.sh adds ruff format --check slack_bolt/ tests/ examples/ so local matches CI

Testing

  • ruff check slack_bolt/ examples/All checks passed (0 D violations; only the intentionally-ignored D100D107 remain).
  • ruff format --check slack_bolt/ tests/ examples/ → clean/idempotent.
  • ./scripts/lint.sh --no-install → green.
  • ./scripts/run_mypy.sh --no-install → no new errors vs main.

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

Enable Ruff's pydocstyle `D` rules with the google convention and
`docstring-code-format`, and fix every resulting violation on docstrings
that already exist across slack_bolt/ and examples/.

- pyproject.toml: select "D" (google convention); ignore only the
  missing-docstring rules D100-D107 so no docstrings are invented where
  none exist; enable docstring-code-format.
- Fix all D2xx/D4xx violations on existing docstrings (D205 blank line
  after summary, D415 terminal punctuation, D417 undocumented params, and
  safe structural fixes). No docstrings added.
- scripts/format.sh: format examples/ too.
- scripts/lint.sh: add `ruff format --check` gate so local matches CI.

Sync/async docstring pairs updated symmetrically.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.54%. Comparing base (5814077) to head (a5430d0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1567   +/-   ##
=======================================
  Coverage   91.54%   91.54%           
=======================================
  Files         228      228           
  Lines        7285     7285           
=======================================
  Hits         6669     6669           
  Misses        616      616           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@WilliamBergamin WilliamBergamin changed the title chore: add docstring formatting + linting with Ruff pydocstyle (D) rules chore: add docstring formatting + linting Aug 27, 2026
WilliamBergamin and others added 2 commits August 27, 2026 17:04
The ruff pydocstyle (D) reformatting enforced docstring shape but not
content, leaving six correctness/consistency defects:

- falcon/resource.py: reformatting turned the usage snippet into an
  invalid example (`app = App().`); restore a proper summary + clean code
- socket_mode base_handler.py / async_base_handler.py: summary split mid
  sentence left a dangling lowercase fragment; merge it back
- __init__.py: "features.Read" was missing a space (shown on PyPI)
- async_app.py dialog_cancellation: summary wrongly said dialog_submission
- app.py / async_app.py step(): de-indent the orphaned Deprecated block
- async_authorize.py: add backticks around `authorize` to mirror the sync
  CallableAuthorize docstring

Docstring-only; no behavior change. Sync/async pairs kept mirrored.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Drop the restatement of what the google convention does (discoverable in
ruff's docs) and keep only the non-obvious footgun: switching the bare
`select = ["D"]` category to explicit D codes overrides the convention.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review August 27, 2026 21:12
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner August 27, 2026 21:12
@WilliamBergamin WilliamBergamin self-assigned this Aug 27, 2026

@lukegalbraithrussell lukegalbraithrussell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exciting!!

The listed 07e8ac9 was the pre-squash branch commit from PR #1566; that
SHA is unreachable from main, so git blame silently ignored the entry.
Point it at the squash-merge commit 5814077, which is the reachable
commit that actually carried the ruff-format sweep onto main.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants