Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
96 lines (79 loc) · 2.83 KB
/
Copy pathJustfile
File metadata and controls
96 lines (79 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Development recipes
set quiet
# List available recipes
default:
@just --list
# Run all checks (format + clippy + tests + file size)
# Silent on success; on a test failure prints the full test log.
check:
#!/usr/bin/env bash
set -euo pipefail
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -q -- -D warnings
log=$(mktemp)
trap 'rm -f "$log"' EXIT
cargo test --workspace -q >"$log" 2>&1 || { cat "$log"; exit 1; }
cargo run -q -- --quiet || { cargo run -q --; exit 1; }
# Run tests only
test *ARGS:
cargo test --workspace {{ ARGS }}
# Run clippy only
clippy:
cargo clippy --workspace --all-targets -q -- -D warnings
# Auto-fix clippy warnings
clippy-fix:
cargo clippy --fix --workspace --all-targets -- -D warnings
# Build the project
build:
cargo build --workspace -q
# Run coverage with tarpaulin (settings live in tarpaulin.toml)
cover:
#!/usr/bin/env bash
set -eo pipefail
log=$(mktemp)
trap 'rm -f "$log"' EXIT
cargo tarpaulin --workspace --skip-clean 2>&1 | tee "$log"
# Tarpaulin only warns on a rejected tarpaulin.toml and silently falls back
# to its defaults — which drops both the engine and the threshold.
if grep -q "Invalid config file" "$log"; then
echo "error: tarpaulin.toml was rejected, coverage ran unconfigured" >&2
exit 1
fi
# Format code
fmt:
cargo fmt --all
# Format check (CI-friendly)
fmt-check:
cargo fmt --all -- --check
# Regenerate the JSON Schema file
schema:
cargo run -q -- schema > linecop-schema.json
# Count tests across workspace
count-tests:
#!/usr/bin/env bash
cargo test --workspace 2>&1 | grep "test result:" | awk '{sum += $4} END {print sum " tests"}'
# Show top 20 files by line count
file-sizes:
#!/usr/bin/env bash
find . -type f \( -name '*.rs' -o -name '*.md' \) ! -path './target/*' -exec wc -l {} + | sort -rn | head -20
# Check for oversized files (fails if any exceed limits)
check-file-size:
cargo run -q -- --quiet
# Fork a sibling worktree on a new branch (`just fork <slug>`); extra flags go to
# `wt switch`, e.g. `--base=@` to branch from HEAD, not main. The `pre-start`
# hook in .config/wt.toml allows the new worktree's `.envrc`.
[positional-arguments]
fork SLUG *ARGS:
wt switch --create --yes "$@"
# Gate, fast-forward the branch onto main and remove its worktree; run it in the
# worktree. `--no-squash --no-commit` keeps each commit's `Refs:` footer and
# refuses a dirty tree instead of committing it; the `pre-merge` hooks in
# .config/wt.toml run the gate and the wip check before the fast-forward.
[positional-arguments]
land *ARGS:
wt merge --no-squash --no-commit --yes "$@"
# Tag and push a release
release version:
@echo "Tagging v{{version}}..."
git tag -a "v{{version}}" -m "Release v{{version}}"
git push origin "v{{version}}"