chore: update flakebox files

This commit is contained in:
thesimplekid
2023-12-19 21:50:42 +00:00
parent f192a53c03
commit 003ecb9dba
5 changed files with 20 additions and 13 deletions

1
.config/flakebox/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
tmp/

View File

@@ -1 +1 @@
437409787773bc012f713d609c43406e98174dca8d94911ed7905618cc62f2d026781205d6583645176c630878fe6a238e3a17b85254677c632ec4c25b699a4a
4554d31c5e79420d5b097aad56a49a1c61bb89f32d6b93fb5ff4d0677bc9b587e3426e881d01f5551ff816cfcec2941d0529130f491f6098abb64e6c28592c94

View File

@@ -2,3 +2,4 @@ group_imports = "StdExternalCrate"
wrap_comments = true
format_code_in_doc_comments = true
imports_granularity = "Module"
edition = "2021"

View File

@@ -11,23 +11,23 @@ default:
# run `cargo build` on everything
build:
build *ARGS="--workspace --all-targets":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo build --workspace --all-targets
cargo build {{ARGS}}
# run `cargo check` on everything
check:
check *ARGS="--workspace --all-targets":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo check --workspace --all-targets
cargo check {{ARGS}}
# run all checks recommended before opening a PR
@@ -70,22 +70,22 @@ test: build
# run and restart on changes
watch:
watch *ARGS="-x run":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
env RUST_LOG=${RUST_LOG:-debug} cargo watch -x run
env RUST_LOG=${RUST_LOG:-debug} cargo watch {{ARGS}}
# run `cargo clippy` on everything
clippy:
cargo clippy --locked --offline --workspace --all-targets -- --deny warnings --allow deprecated
clippy *ARGS="--locked --offline --workspace --all-targets":
cargo clippy {{ARGS}} -- --deny warnings --allow deprecated
# run `cargo clippy --fix` on everything
clippy-fix:
cargo clippy --locked --offline --workspace --all-targets --fix
clippy-fix *ARGS="--locked --offline --workspace --all-targets":
cargo clippy {{ARGS}} --fix
# run `semgrep`

View File

@@ -132,8 +132,13 @@ export -f check_trailing_newline
function check_trailing_whitespace() {
set -euo pipefail
if ! git diff --check HEAD ; then
echo "Trailing whitespace detected. Please remove them before committing."
rev="HEAD"
if ! git rev-parse -q 1>/dev/null HEAD 2>/dev/null ; then
>&2 echo "Warning: no commits yet, checking against --root"
rev="--root"
fi
if ! git diff --check $rev ; then
>&2 echo "Trailing whitespace detected. Please remove them before committing."
return 1
fi