Skip to content

Commit f3f9417

Browse files
committed
just: exclude .direnv from shfmt/taplo/nixfmt/justfile lints
The check/ci/fix recipes globbed the whole tree, so direnv's nix cache (.direnv/, gitignored) tripped shfmt and taplo on generated direnv scripts and crane's vendored test-fixture TOMLs. Real GitHub Actions CI has no .direnv directory, so this only bit local `just ci`. Exclude it via the find `-not -path` lists (nixfmt + justfile), a `grep -v` filter on `shfmt -f` output, and the `.taplo.toml` exclude list.
1 parent 9af929b commit f3f9417

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

.taplo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Skip vendored / build trees so `taplo format` doesn't recurse into them.
2-
exclude = ["**/node_modules/**", "**/target/**", "**/dist/**", "**/.venv/**"]
2+
exclude = ["**/node_modules/**", "**/target/**", "**/dist/**", "**/.venv/**", "**/.direnv/**"]
33

44
# Match the existing repo style (4-space indent on Cargo.toml, lines up
55
# to ~120 chars) so the initial format pass stays minimal.

justfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ check *args:
4949
just js check
5050
just rs check {{ args }}
5151
bun remark . --quiet --frail
52-
@if command -v shellcheck >/dev/null 2>&1 && command -v shfmt >/dev/null 2>&1; then shfmt --diff $(shfmt -f .) && shellcheck $(shfmt -f .); fi
52+
@if command -v shellcheck >/dev/null 2>&1 && command -v shfmt >/dev/null 2>&1; then shfmt --diff $(shfmt -f . | grep -v '\.direnv/') && shellcheck $(shfmt -f . | grep -v '\.direnv/'); fi
5353
@if command -v taplo >/dev/null 2>&1; then RUST_LOG=error taplo format --check; fi
54-
@if command -v nixfmt >/dev/null 2>&1; then nixfmt --check $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*'); fi
55-
@for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*'); do just --fmt --unstable --check --justfile "$f"; done
54+
@if command -v nixfmt >/dev/null 2>&1; then nixfmt --check $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*'); fi
55+
@for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*'); do just --fmt --unstable --check --justfile "$f"; done
5656
just gh check
5757

5858
# Run every per-language `ci` with the diff vs BASE; each greps for its
@@ -96,11 +96,11 @@ ci BASE="":
9696
nix flake check
9797
bun install --frozen-lockfile
9898
bun remark . --quiet --frail
99-
shfmt --diff $(shfmt -f .)
100-
shellcheck $(shfmt -f .)
99+
shfmt --diff $(shfmt -f . | grep -v '\.direnv/')
100+
shellcheck $(shfmt -f . | grep -v '\.direnv/')
101101
RUST_LOG=error taplo format --check
102-
nixfmt --check $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*')
103-
for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*'); do just --fmt --unstable --check --justfile "$f"; done
102+
nixfmt --check $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*')
103+
for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*'); do just --fmt --unstable --check --justfile "$f"; done
104104
just gh ci
105105
106106
# Auto-fix linting/formatting issues across all languages.
@@ -111,10 +111,10 @@ fix:
111111
just rs fix
112112
just py fix
113113
bun remark . --quiet --output
114-
@if command -v shfmt >/dev/null 2>&1; then shfmt --write $(shfmt -f .); fi
114+
@if command -v shfmt >/dev/null 2>&1; then shfmt --write $(shfmt -f . | grep -v '\.direnv/'); fi
115115
@if command -v taplo >/dev/null 2>&1; then RUST_LOG=error taplo format; fi
116-
@if command -v nixfmt >/dev/null 2>&1; then nixfmt $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*'); fi
117-
@for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*'); do just --fmt --unstable --justfile "$f"; done
116+
@if command -v nixfmt >/dev/null 2>&1; then nixfmt $(find . -name '*.nix' -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*'); fi
117+
@for f in $(find . -name justfile -not -path './node_modules/*' -not -path './target/*' -not -path './.venv/*' -not -path './.direnv/*'); do just --fmt --unstable --justfile "$f"; done
118118

119119
# Build the packages.
120120
build:

0 commit comments

Comments
 (0)