Skip to content

Commit 8130fe7

Browse files
committed
Coding style: Add a section about separators
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent f6dca3b commit 8130fe7

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Compact reference for AI code generation. Human docs: [CONTRIBUTING.md](../CONTR
4646
its public `test_foo()`. Do not group all helpers at top and all public functions at bottom
4747
- [ ] Tests: use `pytest.skip("reason")` when a platform/topology condition is not met; never
4848
use bare `return` as a silent skip
49+
- [ ] No separator comments (`# ---- Section ----`); needing them signals the file/class is too
50+
large and should be split
4951

5052
---
5153

@@ -198,6 +200,10 @@ from __future__ import annotations # Remove when switching to Python 3.10+.
198200

199201
Refer to callables as `'configure()'`, `'close()'`; non-callables as `'outdir'`, `'_pman'`.
200202

203+
Do not use separator/divider comments (e.g., `# ---- Section ----`) to split a file or class into
204+
sections. If a file or class feels large enough to need visual separators, it should be refactored
205+
into smaller files or classes instead.
206+
201207
Violation regex: `^\s*#[^#].*[^.]$`
202208

203209
---

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,22 @@ When referring to a function, method, or other identifier in a comment, use sing
537537
parentheses for callables: `'configure()'`, `'close()'`. For non-callables, use single quotes
538538
without parentheses: `'outdir'`, `'_pman'`.
539539

540+
### No Separator Comments
541+
542+
Do not use separator or divider comments to split a file or class into visual sections:
543+
544+
```python
545+
# WRONG: separator comment.
546+
# ---------- Set functions ------------------
547+
548+
# WRONG: any variation of a visual divider.
549+
# ============================================
550+
# ############################################
551+
```
552+
553+
If a file or class feels large enough to need such separators, treat it as a signal that the code
554+
should be refactored into smaller files or classes instead.
555+
540556
### Messages
541557

542558
#### Small vs Capital Letters in Messages

0 commit comments

Comments
 (0)