Skip to content

chore: add docstring formatting + linting - #1959

Merged
WilliamBergamin merged 4 commits into
mainfrom
docstring-pydocstyle-lint
Sep 4, 2026
Merged

chore: add docstring formatting + linting#1959
WilliamBergamin merged 4 commits into
mainfrom
docstring-pydocstyle-lint

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports bolt-python #1567 to this repo: enables Ruff's pydocstyle rules with the google convention and docstring-code-format, and fixes the resulting violations on existing docstrings rather than suppressing them.

Note on the legacy slack/ package

slack/ is normally in maintenance mode, but these changes are cosmetic (docstring-only) and it is already inside the ruff check scope, so its docstrings are fixed too rather than excluded.

Content-defect pass

The mechanical D205 (blank-line-after-summary) + D415 (terminal-period) fixes can split a single sentence that was wrapped across multiple physical lines into a grammatically broken summary + orphaned body. Those were hand-reflowed into a proper summary + body (mirrors bolt #1567's second commit).

Verification

  • ruff check slack/ slack_sdk/All checks passed (E501 confirms every reflow stays ≤125)
  • ruff format --check → idempotent
  • python scripts/codegen.py --path . → re-running leaves the generated trio unchanged (source/generated in sync)
  • mypy → Success, no issues found in 107 source files
  • tests/slack_sdk/models/ → 326 passed; import smoke across sync/async/legacy clients

Follow-up

After merge, add the squash-merge SHA to .git-blame-ignore-revs so git blame skips this sweep (mirrors bolt).

🤖 Generated with Claude Code

Enable Ruff's pydocstyle (D) rules with the google convention and docstring-code-format, and fix the resulting violations on existing docstrings. Only the missing-docstring rules (D100-D107) and D417 (undocumented-param, almost entirely **kwargs/**others boilerplate) are ignored, so no docstrings are invented where none exist.

Docstrings are reshaped to a one-line summary, a blank line before the body, and terminal punctuation. Web API method docstrings are fixed in the canonical source (slack_sdk/web/client.py) and the async/legacy clients are regenerated via scripts/codegen.py. Legacy slack/ package docstrings are fixed too.

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

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.13%. Comparing base (2643bcc) to head (d2bd00a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1959      +/-   ##
==========================================
+ Coverage   84.10%   84.13%   +0.02%     
==========================================
  Files         118      118              
  Lines       13553    13553              
==========================================
+ Hits        11399    11403       +4     
+ Misses       2154     2150       -4     

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

@WilliamBergamin WilliamBergamin self-assigned this Sep 4, 2026
@WilliamBergamin WilliamBergamin added the docs M-T: Documentation work only label Sep 4, 2026
WilliamBergamin and others added 2 commits September 4, 2026 14:33
The D205/D212/D415 autofix truncated two wrapped-sentence docstrings in
basic_components.py (Option.__init__, OptionGroup.__init__). Reflow them
into a proper summary + body; stays lint-green under the google convention.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
ContainerBlock (#1949) landed on main before the D-rules were enabled and
was merged into this branch, tripping D205/D415. Add the blank line after
the summary so `ruff check` passes tree-wide.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review September 4, 2026 18:40
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner September 4, 2026 18:40

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@WilliamBergamin The health of code is better with these changes. Thanks true immense. I leave comments but nothing blocking.

class SignatureVerifier:
def __init__(self, signing_secret: str, clock: Clock = Clock()):
"""Slack request signature verifier
"""Slack request signature verifier.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🌟 praise: I'm so glad this can be enforced with linting.

"""
Use the select element for multiple choice selections allowing users to pick a
single item from a list. True to web roots, this selection is displayed as a
"""Use the select element for multiple choice selections allowing users to pick a single item from a list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🌲 praise: Big fan of infinite line lengths to let editors wrap however preferred.

Comment thread pyproject.toml
Comment on lines +63 to +75
ignore = [
# missing-docstring: do not add docstrings where none exist
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
# undocumented-param: 51/54 cases are just **others/**kwargs boilerplate in Block Kit models
"D417",
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👁️‍🗨️ question: Do we have a goal to remove these over time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yess the goal is to remove them but it would introduce to many breaking changes

@zimeg zimeg added this to the 3.next milestone Sep 4, 2026
@WilliamBergamin
WilliamBergamin merged commit 8c4882d into main Sep 4, 2026
18 checks passed
@WilliamBergamin
WilliamBergamin deleted the docstring-pydocstyle-lint branch September 4, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs M-T: Documentation work only semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants