Add pre-commit hooks

This commit is contained in:
atse 2024-08-06 16:03:39 +08:00
parent 111bba2ac9
commit 831bec717c
2 changed files with 25 additions and 0 deletions

24
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [commit]
repos:
- repo: local
hooks:
- id: cargo-fmt
name: cargo format
entry: cargo
language: system
types: [file, rust]
pass_filenames: false
description: Runs cargo fmt on the codebase.
args: [fmt]
- id: cargo-clippy
name: cargo clippy
entry: cargo
language: system
types: [file, rust]
pass_filenames: false
description: Runs cargo clippy on the codebase.
args: [clippy]

View File

@ -64,6 +64,7 @@
packages = with pkgs; [ packages = with pkgs; [
rust llvm rust llvm
openocd dfu-util openocd dfu-util
pre-commit
] ++ (with python3Packages; [ ] ++ (with python3Packages; [
numpy matplotlib numpy matplotlib
]); ]);