|
| 1 | +# HyprRice Style Guide |
| 2 | + |
| 3 | +## Documentation Style |
| 4 | + |
| 5 | +- Use Markdown for all documentation files. |
| 6 | +- Start each doc with a top-level heading (`# Title`). |
| 7 | +- Use second-level headings (`##`) for major sections. |
| 8 | +- Use bullet points for lists, numbered lists for steps. |
| 9 | +- Use fenced code blocks for code and commands. |
| 10 | +- Reference files and classes as `filename.py`, `ClassName`. |
| 11 | +- Use relative links for docs and images. |
| 12 | +- Add a Table of Contents for docs longer than 2 pages. |
| 13 | +- Use screenshots in `docs/screenshots/` and reference them inline. |
| 14 | +- Cross-link related docs for easy navigation. |
| 15 | + |
| 16 | +## Code Style |
| 17 | + |
| 18 | +- Follow [PEP 8](https://peps.python.org/pep-0008/) for Python code. |
| 19 | +- Use type hints for all functions and methods. |
| 20 | +- Use Google-style docstrings for all public functions/classes. |
| 21 | +- Keep functions focused and small. |
| 22 | +- Use descriptive variable and function names. |
| 23 | +- Group imports: standard library, third-party, local. |
| 24 | +- Use `snake_case` for variables/functions, `CamelCase` for classes. |
| 25 | +- Document exceptions and side effects. |
| 26 | + |
| 27 | +## Naming Conventions |
| 28 | + |
| 29 | +- Files: `lowercase_with_underscores.py` |
| 30 | +- Classes: `CamelCase` |
| 31 | +- Functions/variables: `snake_case` |
| 32 | +- Constants: `UPPERCASE` |
| 33 | + |
| 34 | +## Example Docstring |
| 35 | + |
| 36 | +```python |
| 37 | +from typing import Dict, Any |
| 38 | + |
| 39 | +def process_config(config: Dict[str, Any]) -> bool: |
| 40 | + """ |
| 41 | + Process and validate configuration. |
| 42 | +
|
| 43 | + Args: |
| 44 | + config (Dict[str, Any]): Configuration dictionary. |
| 45 | +
|
| 46 | + Returns: |
| 47 | + bool: True if valid, False otherwise. |
| 48 | + """ |
| 49 | + if not isinstance(config, dict): |
| 50 | + return False |
| 51 | + return True |
| 52 | +``` |
| 53 | + |
| 54 | +## Screenshot Guidelines |
| 55 | + |
| 56 | +- Save images in `docs/screenshots/`. |
| 57 | +- Use descriptive filenames (e.g., `main_window.png`). |
| 58 | +- Reference with ``. |
| 59 | +- Add captions below screenshots if needed. |
| 60 | + |
| 61 | +## Markdown Example |
| 62 | + |
| 63 | +````markdown |
| 64 | +# Section Title |
| 65 | + |
| 66 | +## Subsection |
| 67 | + |
| 68 | +- Use bullet points for lists. |
| 69 | +- Use fenced code blocks for code. |
| 70 | +- Reference files as `filename.py`. |
| 71 | +- Use relative links for docs. |
| 72 | +```` |
| 73 | + |
| 74 | +## Pull Requests & Reviews |
| 75 | + |
| 76 | +- Ensure all new code and docs follow this style guide. |
| 77 | +- Reviewers should check for style, clarity, and consistency. |
| 78 | +- Update this guide as the project evolves. |
0 commit comments