From 271dd875bd36a0c204a74dfba7f0e355949b3186 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 12 Jun 2024 13:09:37 +0800 Subject: [PATCH] meta: Update README to include info regarding pre-commit hooks --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 5220850..40b0d07 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,12 @@ Use ``nix develop`` in this repository to enter a development shell. If you are using a different shell than bash you can use e.g. ``nix develop --command fish``. Build NAC3 with ``cargo build --release``. See the demonstrations in ``nac3artiq`` and ``nac3standalone``. + +### Pre-Commit Hooks + +You are strongly recommended to use the provided pre-commit hooks to automatically reformat files and check for non-optimal Rust practices using Clippy. Run `pre-commit install` to install the hook and `pre-commit` will automatically run `cargo fmt` and `cargo clippy` for you. + +Several things to note: + +- If `cargo fmt` or `cargo clippy` returns an error, the pre-commit hook will fail. You should fix all errors before trying to commit again. +- If `cargo fmt` reformats some files, the pre-commit hook will also fail. You should review the changes and, if satisfied, try to commit again.