Skip to content

Commit 2112c92

Browse files
committed
ai(rules[AGENTS]) Require Attributes on classes with fields
why: autodoc renders every NamedTuple and dataclass field regardless of whether it is described, so an undocumented field reaches the API docs as "Alias for field number 0" or as a bare entry. Fourteen such stubs are live on the published site today, and nothing in the gates catches them. what: - Require an Attributes section covering every field, with an example - Note that partial coverage still ships stubs for the rest
1 parent e039042 commit 2112c92

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,27 @@ type
217217
"""
218218
```
219219

220+
**Classes with fields**`NamedTuple`, dataclasses — document every field in
221+
an `Attributes` section:
222+
223+
```python
224+
class VCSLocation(t.NamedTuple):
225+
"""Generic VCS Location (URL and optional revision).
226+
227+
Attributes
228+
----------
229+
url : str
230+
Repository URL, with any revision suffix stripped.
231+
rev : str | None
232+
Revision to check out, or ``None`` when unspecified.
233+
"""
234+
```
235+
236+
Autodoc renders every field whether or not you describe it, so an
237+
undocumented `NamedTuple` field ships to the API docs as "Alias for field
238+
number 0" and a dataclass field ships bare. Document all of them — a class
239+
with three fields and two documented still ships a stub for the third.
240+
220241
### Doctests
221242

222243
**All functions and methods MUST have working doctests.** Doctests serve as both documentation and tests.

0 commit comments

Comments
 (0)