|
| 1 | +# GitHub Copilot Instructions |
| 2 | + |
| 3 | +## Code Writing Standards |
| 4 | +- Follow established code-writing standards for your language (spacing, comments, naming). |
| 5 | +- Consider internal coding rules for folder and function naming. |
| 6 | +- Follow the "boy scout rule": Always leave the codebase cleaner than you found it. |
| 7 | + |
| 8 | +## Comment Usage |
| 9 | +- Use comments sparingly and make them meaningful. |
| 10 | +- Avoid commenting on obvious things; use comments to explain "why" or unusual behavior. |
| 11 | + |
| 12 | +## Conditional Encapsulation |
| 13 | +- Encapsulate nested if/else statements into functions with descriptive names for clarity. |
| 14 | + |
| 15 | +## DRY Principle |
| 16 | +- Avoid code duplication; reuse code via functions, classes, modules, or libraries. |
| 17 | +- Modify code in one place if updates are needed. |
| 18 | + |
| 19 | +## Function Length & Responsibility |
| 20 | +- Write short, focused functions (single responsibility principle). |
| 21 | +- Break up long or complex functions into smaller ones. |
| 22 | + |
| 23 | +## General Code Style & Readability |
| 24 | +- Write readable, understandable, and maintainable code. |
| 25 | +- Prioritize clarity and adhere to coding standards. |
| 26 | +- Regularly review and refactor code for structure and maintainability. |
| 27 | +- Use version control (e.g., Git) for collaboration. |
| 28 | + |
| 29 | +## Naming Conventions |
| 30 | +- Use meaningful, descriptive names for variables, functions, and classes. |
| 31 | +- Names should reflect purpose and behavior; avoid names that require comments to explain intent. |
| 32 | + |
| 33 | +## Making your changes pass CI |
| 34 | +- Before submitting any changes, make sure to run the following commands: |
| 35 | + - `cargo fmt` to format all code according to the style guidelines. |
| 36 | + - `RUSTFLAGS="-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D function_item_references -D clippy::uninlined_format_args " cargo clippy --all --exclude wasmer-swift --locked --fix --allow-dirty -- -D clippy::all` to check for common mistakes and improve code quality. |
| 37 | +- If these commands don't pass, CI will reject your changes. |
| 38 | +- Run the tests for the code you changed and everything that depends on it. |
0 commit comments