| 1 |
<!-- Copyright 2025 The Fuchsia Authors |
| 2 |
|
| 3 |
Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 |
| 4 |
<LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT |
| 5 |
license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. |
| 6 |
This file may not be copied, modified, or distributed except according to |
| 7 |
those terms. --> |
| 8 |
|
| 9 |
# Style Guidelines |
| 10 |
|
| 11 |
This document covers code style and formatting guidelines for the project, as |
| 12 |
well as commit message requirements. |
| 13 |
|
| 14 |
## File Headers |
| 15 |
|
| 16 |
Each file must contain a copyright header (see `src/lib.rs` for example) which is |
| 17 |
based on that file's creation year. |
| 18 |
|
| 19 |
## Formatting |
| 20 |
|
| 21 |
Refer to `ci/check_fmt.sh`. |
| 22 |
|
| 23 |
## Comments |
| 24 |
|
| 25 |
- Wrap all comments (`//`, `///`, `//!`) at **80 columns** from the left margin, |
| 26 |
taking into account any preceding code or comments. |
| 27 |
- **Exceptions:** Markdown tables, ASCII diagrams, long URLs, code blocks, or |
| 28 |
other cases where wrapping would impair readability. |
| 29 |
|
| 30 |
## Markdown Files |
| 31 |
|
| 32 |
- Wrap paragraphs and bulleted lists at **80 columns** from the left margin, |
| 33 |
taking into account any preceding code or comments. For example, a markdown |
| 34 |
block inside of a `/// Lorem ipsum...` comment should have lines no more than |
| 35 |
76 columns wide. |
| 36 |
- In bulleted lists, indent subsequent lines by 2 spaces. |
| 37 |
- Do not wrap links if it breaks them. |
| 38 |
- Always put a blank line between a section header and the beginning of the section. |
| 39 |
|
| 40 |
## Pull Requests and Commit Messages |
| 41 |
|
| 42 |
Use GitHub issue syntax in commit messages: |
| 43 |
|
| 44 |
- Resolves issue: `Closes #123` |
| 45 |
- Progress on issue: `Makes progress on #123` |