Skip to content

Commit 2ff16ed

Browse files
committed
docs: give section banners precedence in new-public-api rule
1 parent 26ce91f commit 2ff16ed

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

references/code-style.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ violates one is not done.
135135
place. Never interleave a helper between the public API methods of a flow -
136136
no public method immediately followed by its own private helper. A reader
137137
scanning the public surface must not trip over internals.
138-
2. **New public API goes last.** The public API for a new, independent feature
139-
is added at the end of the class, so existing flows stay contiguous and read
140-
top to bottom. Insert new methods without reordering existing declarations.
141-
Keep the diff minimal.
138+
2. **New public API goes last.** A pre-existing `# ==== SECTION ====` banner
139+
takes precedence: place a new method in its matching section (see "Section
140+
banners" above). Only when no matching section exists is a new, independent
141+
feature's public API added at the end of the class, so existing flows stay
142+
contiguous and read top to bottom. Either way, insert new methods without
143+
reordering existing declarations, and keep the diff minimal.
142144
3. **Standard docstring format.** A crisp one-line description of what the
143145
function does, then `Args`, then `Returns`/`Raises`. No multi-line prose
144146
restating the code or narrating design rationale - that belongs in the PR

0 commit comments

Comments
 (0)