docs(contributing): add code style guidelines
Swadhin Biswas committed 7 months ago
8688339
1 parent a707248
commit 8688339
1 file changed
+60 -0
Showing 1 changed file+60-0
▼CONTRIBUTING.md
+60-0
| @@ -218,3 +218,63 @@ mod tests { | ||
218 | 218 | let result = my_function("input"); |
219 | 219 | assert_eq!(result, "expected output"); |
220 | 220 | } |
221 | +} | |
222 | +``` | |
223 | + | |
224 | +### What to Test | |
225 | + | |
226 | +- Parsing functions (uptime, memory, CPU info) | |
227 | +- Config loading and defaults | |
228 | +- ASCII art color placeholder substitution | |
229 | +- Utility functions (padding, truncation, width) | |
230 | + | |
231 | +### Coverage | |
232 | + | |
233 | +CI runs `cargo-tarpaulin` and uploads to [Codecov](https://codecov.io). Check coverage before submitting: | |
234 | + | |
235 | +```bash | |
236 | +cargo install cargo-tarpaulin | |
237 | +cargo tarpaulin --all-features | |
238 | +``` | |
239 | + | |
240 | +--- | |
241 | + | |
242 | +## Pull Request Process | |
243 | + | |
244 | +1. **Fork** the repository and create a feature branch from `main` | |
245 | + | |
246 | +2. **Make your changes** — keep PRs focused on one thing | |
247 | + | |
248 | +3. **Run checks locally:** | |
249 | + | |
250 | + ```bash | |
251 | + cargo fmt --all -- --check # Format check | |
252 | + cargo clippy -- -D warnings # Lint check | |
253 | + cargo test # All tests pass | |
254 | + cargo build --release # Clean release build (0 warnings) | |
255 | + ``` | |
256 | + | |
257 | +4. **Push** to your fork and open a PR against `main` | |
258 | + | |
259 | +5. **Fill out the PR template** — describe changes, link issues, add screenshots | |
260 | + | |
261 | +6. **Wait for CI** — all checks must pass (lint, test, build) | |
262 | + | |
263 | +7. **Address review feedback** — maintainers may request changes | |
264 | + | |
265 | +8. **Merge!** — once approved, a maintainer will merge your PR | |
266 | + | |
267 | +### PR Tips | |
268 | + | |
269 | +- Keep diffs small and focused — large PRs are harder to review | |
270 | +- Add screenshots for visual changes (new logos, layout changes) | |
271 | +- If adding a feature, update the README and config example | |
272 | +- If fixing a bug, add a test that catches the regression | |
273 | + | |
274 | +--- | |
275 | + | |
276 | +## Development Tips | |
277 | + | |
278 | +### Quick Iteration | |
279 | + | |
280 | +```bash | |
221 | 281 | |