From 6b5ea1f0e08cbb6e06d894d0d10657206d861db8 Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Tue, 25 Aug 2026 16:20:52 +0100 Subject: [PATCH 1/2] Add prek configuration to check linting prior to CI --- .github/workflows/ci.yml | 2 +- .gitignore | 2 +- prek.toml | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 prek.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9318b9..883860d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info - name: Upload coverage to Codecov - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7 + uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7 with: files: lcov.info fail_ci_if_error: true diff --git a/.gitignore b/.gitignore index dba0af2..d79ca70 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ # Demo database and file number directories *.db -trackers/ \ No newline at end of file +trackers/ diff --git a/prek.toml b/prek.toml new file mode 100644 index 0000000..3ccf7d1 --- /dev/null +++ b/prek.toml @@ -0,0 +1,24 @@ +[[repos]] +repo = "builtin" +hooks = [ + { id = "check-added-large-files", exclude = "^Cargo.lock$" }, + { id = "check-merge-conflict" }, + { id = "check-toml" }, + { id = "end-of-file-fixer" }, + { id = "mixed-line-ending", args = ["--fix", "lf" ]}, + { id = "trailing-whitespace", exclude = "static/service_schema.graphql"}, +] + +[[repos]] +repo = "local" +hooks = [ + # fmt needs to be called via rustup to support nightly + { id = "format", name = "cargo fmt", entry = "rustup run nightly cargo fmt", language = "rust", pass_filenames = false }, + { id = "compile", name = "cargo check", entry = "cargo check", language = "rust", pass_filenames = false }, + { id = "lint", name = "cargo clippy", entry = "cargo clippy --all-targets --all-features -- --deny warnings", language = "rust" , pass_filenames = false }, +] + +[[repos]] +repo = "https://github.com/gitleaks/gitleaks" +rev = "v8.30.1" +hooks = [{ id = "gitleaks" }] From 44aa879e41d535a61664daf30ae8de252b0d99ab Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Thu, 27 Aug 2026 17:19:09 +0100 Subject: [PATCH 2/2] Add justfile for common tasks (#297) --- justfile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..d298250 --- /dev/null +++ b/justfile @@ -0,0 +1,9 @@ +lint: + prek run --all-files + +test: + cargo test + +coverage: + cargo tarpaulin --target-dir target/coverage --skip-clean + xdg-open tarpaulin-report.html