diff --git a/.config/flakebox/id b/.config/flakebox/id index c248762..665453f 100644 --- a/.config/flakebox/id +++ b/.config/flakebox/id @@ -1 +1 @@ -4554d31c5e79420d5b097aad56a49a1c61bb89f32d6b93fb5ff4d0677bc9b587e3426e881d01f5551ff816cfcec2941d0529130f491f6098abb64e6c28592c94 +3df12aefd7925a90e8a0e09b721df7d8435ed993774832d5aca2cba090b3d23e11f68bd4826bbf10ca7944dcfa82165dcd5285634f9fcf76e00308bb314664bb diff --git a/.config/flakebox/shellHook.sh b/.config/flakebox/shellHook.sh index 136ed52..0a15c65 100644 --- a/.config/flakebox/shellHook.sh +++ b/.config/flakebox/shellHook.sh @@ -1,4 +1,16 @@ #!/usr/bin/env bash +yesterday=$(date -d "yesterday" +%s) +motd_ts_path=".config/flakebox/tmp/motd" + +if [ ! -e "$motd_ts_path" ] || [ "$motd_ts_path" -ot "$yesterday" ]; then +mkdir -p "$(dirname "$motd_ts_path")" +touch "$motd_ts_path" +>&2 echo "🚧 In an enfort to improve documentation, we now require all structs and" +>&2 echo "🚧 and public methods to be documented with a docstring." +>&2 echo "🚧 See https://github.com/fedimint/fedimint/issues/3807" + +fi + root="$(git rev-parse --show-toplevel)" dot_git="$(git rev-parse --git-common-dir)" if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi diff --git a/JUSTFILE b/JUSTFILE index 1eef9c4..d0f429c 100644 --- a/JUSTFILE +++ b/JUSTFILE @@ -1,7 +1,5 @@ # THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION -import 'justfile.local.just' - -set dotenv-load := true +import "justfile.local.just" alias b := build alias c := check @@ -33,17 +31,6 @@ check *ARGS="--workspace --all-targets": cargo check {{ARGS}} -# run all checks recommended before opening a PR -final-check: lint clippy - #!/usr/bin/env bash - set -euo pipefail - if [ ! -f Cargo.toml ]; then - cd {{invocation_directory()}} - fi - cargo test --doc - just test - - # run code formatters format: #!/usr/bin/env bash diff --git a/misc/git-hooks/pre-commit b/misc/git-hooks/pre-commit index 7959e97..29aef59 100755 --- a/misc/git-hooks/pre-commit +++ b/misc/git-hooks/pre-commit @@ -48,6 +48,43 @@ function check_cargo_lock() { } export -f check_cargo_lock +function check_check_forbidden_dependencies() { + set -euo pipefail + + #!/usr/bin/env bash + + set -eo pipefail + + if grep -E "(fedimint-mint|fedimint-wallet|fedimint-ln)" fedimint-server/Cargo.toml >&2 ; then + >&2 echo "fedimint-server/Cargo.toml must not depend on modules" + return 1 + fi + if grep -E "(fedimint-mint|fedimint-wallet|fedimint-ln-(server|common|client))" fedimint-testing/Cargo.toml >&2 ; then + >&2 echo "fedimint-testing/Cargo.toml must not depend on modules" + return 1 + fi + find gateway/ -name Cargo.toml | while read -r cargo_toml ; do + if grep -E "fedimint-server" "$cargo_toml" >&2 ; then + >&2 echo "$cargo_toml must not depend on fedimint-server" + return 1 + fi + done + find fedimint-client/ -name Cargo.toml | while read -r cargo_toml ; do + if grep -E "fedimint-server" "$cargo_toml" >&2 ; then + >&2 echo "$cargo_toml must not depend on fedimint-server" + return 1 + fi + done + find ./ -name Cargo.lock | while read -r cargo_lock ; do + if grep -E "openssl" "$cargo_lock" >&2 ; then + >&2 echo "$cargo_lock must not depend on openssl" + return 1 + fi + done + +} +export -f check_check_forbidden_dependencies + function check_leftover_dbg() { set -euo pipefail @@ -102,33 +139,6 @@ function check_shellcheck() { } export -f check_shellcheck -function check_trailing_newline() { - set -euo pipefail - - errors="" - for path in $(echo "$FLAKEBOX_GIT_LS_TEXT"); do - - # extra branches for clarity - if [ ! -s "$path" ]; then - # echo "$path is empty" - true - elif [ -z "$(tail -c 1 < "$path")" ]; then - # echo "$path ends with a newline or with a null byte" - true - else - >&2 echo "$path doesn't end with a newline" 1>&2 - errors="true" - fi - done - - if [ -n "$errors" ]; then - >&2 echo "Fix the problems above or use --no-verify" 1>&2 - return 1 - fi - -} -export -f check_trailing_newline - function check_trailing_whitespace() { set -euo pipefail @@ -161,10 +171,10 @@ parallel \ ::: \ check_cargo_fmt \ check_cargo_lock \ + check_check_forbidden_dependencies \ check_leftover_dbg \ check_semgrep \ check_shellcheck \ - check_trailing_newline \ check_trailing_whitespace \ check_typos \ check_nothing