Skip to content

docs: fix docstring config and sweep DOC503 violations#9

Closed
llucax with Copilot wants to merge 3 commits into
v1.x.xfrom
copilot/check-fix-improve-docstrings
Closed

docs: fix docstring config and sweep DOC503 violations#9
llucax with Copilot wants to merge 3 commits into
v1.x.xfrom
copilot/check-fix-improve-docstrings

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown

Aligns mkdocs.yml and pyproject.toml with the Frequenz Python docstring conventions, then fixes all pydoclint violations surfaced by the updated config.

Config (mkdocs.yml)

  • Added relative_crossrefs: true (convention roll-out) and show_symbol_type_toc: true

Config (pyproject.toml[tool.flake8] pydoclint options)

Added missing keys (alphabetically ordered):

  • check-class-attributes = true
  • check-style-mismatch = true (convention roll-out)
  • require-inline-class-var-docs = true (convention roll-out)
  • skip-checking-short-docstrings = true

DOC503 fixes — 11 violations

Removed incorrect parent-class exceptions (subclass is what's actually raised):

  • _anycast.py, _merge.py, _merge_named.py: removed ReceiverError from Raises: (only ReceiverStoppedError raised directly)
  • _bidirectional.py: removed ReceiverStoppedError from Raises: (only ReceiverError raised directly)

Added # noqa: DOC503 where exceptions are raised indirectly (same pattern as existing DOC502 suppressions):

  • _base_classes.py Receiver.__anext__ / receiveReceiverError propagates from inner calls
  • util/_event.py Event.consume — pydoclint qualified-name mismatch (_exceptions.ReceiverStoppedError)
  • util/_select.py Selected.value / select() — stored exception and indirect raise via _stop_pending_tasks()
  • util/_timer.py Timer.__init__ / resetRuntimeError from asyncio.get_running_loop()

Docstring text fixes

  • Error.__init__: summary said "Create a ChannelError instance" (wrong class)
  • Receiver.receive: ReceiverStoppedError description said "if there is some problem" instead of "if the receiver stopped producing messages"

Style improvements

Per convention (properties → one-liner noun phrase; zero-arg return methods → one-liner imperative), removed redundant Returns: sections from properties and __str__/__repr__ methods across _bidirectional.py, _event.py, _select.py, and _timer.py.

Copilot AI added 3 commits June 30, 2026 07:26
Add missing mkdocstrings options to mkdocs.yml:
- `relative_crossrefs: true` (convention roll-out)
- `show_symbol_type_toc: true`

Add missing pydoclint options to pyproject.toml [tool.flake8]:
- `check-class-attributes = true`
- `check-style-mismatch = true` (convention roll-out)
- `require-inline-class-var-docs = true` (convention roll-out)
- `skip-checking-short-docstrings = true`

Options are ordered alphabetically within each block.

Signed-off-by: Copilot <copilot@github.com>
Remove extraneous exceptions from Raises sections where only the
subclass is directly raised (ReceiverError when only ReceiverStoppedError
is raised):
- _anycast.py: Receiver.consume
- _bidirectional.py: Handle.consume
- util/_merge.py: Merge.consume
- util/_merge_named.py: MergeNamed.consume

Add # noqa: DOC503 where exceptions are raised indirectly (e.g., via
asyncio.get_running_loop() or qualified-name import mismatch):
- _base_classes.py: Receiver.__anext__, Receiver.receive
- util/_event.py: Event.consume
- util/_select.py: Selected.value, select()
- util/_timer.py: Timer.__init__, Timer.reset

Also fix misleading Raises description in Receiver.receive: the
ReceiverStoppedError description was "if there is some problem with
the receiver" (should be "if the receiver stopped producing messages").

Signed-off-by: Copilot <copilot@github.com>
Simplify property docstrings to the conventional one-liner noun-phrase
format (removing redundant Returns: sections that repeat the summary):
- _bidirectional.py: Bidirectional.client_handle, service_handle
- util/_event.py: Event.name, is_set, is_stopped
- util/_timer.py: SkipMissedAndDrift.delay_tolerance, Timer.interval,
  missed_tick_policy, loop, is_running

Simplify no-arg methods that only return/print self to one-liner
imperative format (removing redundant Returns: sections):
- _base_classes.py: Receiver.__aiter__
- util/_event.py: Event.__str__, __repr__
- util/_select.py: Selected.__str__, __repr__
- util/_timer.py: MissedTickPolicy.__repr__, SkipMissedAndDrift.__str__,
  __repr__, Timer._now, __str__, __repr__

Fix wrong class name in Error.__init__ docstring ("Create a ChannelError
instance" -> "Create an instance").

Add cross-references to Bidirectional.client_handle and service_handle.

Signed-off-by: Copilot <copilot@github.com>
Copilot AI changed the title docs: fix and improve project docstrings configuration and violations docs: fix docstring config and sweep DOC503 violations Jun 30, 2026
Copilot AI requested a review from llucax June 30, 2026 07:32
@llucax llucax closed this Jun 30, 2026
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