forked from entireio/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
96 lines (81 loc) · 2.99 KB
/
mise.toml
File metadata and controls
96 lines (81 loc) · 2.99 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
[tools]
# Please also keep the version aligned in the go.mod file
go = { version = '1.25.6', postinstall = "go install github.com/go-delve/delve/cmd/dlv@latest" }
golangci-lint = 'latest'
shellcheck = 'latest'
[tasks.fmt]
description = "Run gofmt"
run = "gofmt -s -w ."
[tasks.test]
description = "Run tests"
run = "go test ./..."
[tasks."test:integration"]
description = "Run integration tests"
run = "go test -tags=integration ./cmd/entire/cli/integration_test/..."
[tasks."test:ci"]
description = "Run all tests (unit + integration) with race detection"
run = "go test -tags=integration -race ./..."
[tasks.build]
description = "Build the CLI"
run = """
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
go build -ldflags "-X github.com/entireio/cli/cmd/entire/cli/buildinfo.Version=${VERSION} -X github.com/entireio/cli/cmd/entire/cli/buildinfo.Commit=${COMMIT}" -o entire ./cmd/entire
"""
[tasks."build:all"]
description = "Build for all platforms using goreleaser"
run = "goreleaser build --snapshot --clean"
[tasks."completions"]
description = "generate entire shell completions"
quiet = true
run = """
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run ./cmd/entire/main.go completion "$sh" >"completions/entire.$sh"
done
"""
[tasks.dup]
description = "Check for code duplication (threshold 50, with summary)"
run = """
#!/usr/bin/env bash
set -euo pipefail
# Create temp files with proper extensions (works on both Linux and macOS)
tmpdir=$(mktemp -d)
config="$tmpdir/config.yaml"
json_out="$tmpdir/output.json"
cat > "$config" << 'YAML'
version: "2"
linters:
default: none
enable: [dupl]
settings:
dupl:
threshold: 50
YAML
# Run with JSON output for summary, text output for details
golangci-lint run -c "$config" --new=false --max-issues-per-linter=0 --max-same-issues=0 \
--output.json.path="$json_out" --output.text.path=/dev/stderr ./... 2>&1 || true
# Print summary grouped by file
echo ""
echo "=== Duplication Summary (by file) ==="
if command -v jq &>/dev/null && [ -s "$json_out" ]; then
jq -r '.Issues // [] | group_by(.Pos.Filename) | map({file: (.[0].Pos.Filename | split("/") | .[-1]), count: length}) | sort_by(-.count) | .[] | " " + (.count|tostring) + " " + .file' "$json_out" 2>/dev/null || echo " (no issues)"
else
echo " (install jq for summary)"
fi
rm -rf "$tmpdir"
"""
[tasks."dup:staged"]
description = "Check duplication in staged files only (threshold 75, same as CI)"
run = """
#!/usr/bin/env bash
set -euo pipefail
# Get staged Go files, preserving paths with spaces using null delimiters throughout
if ! git diff --cached --name-only -z --diff-filter=ACM | grep -z '\\.go$' | grep -zq .; then
echo "No staged Go files to check"
exit 0
fi
echo "Checking staged files for duplication..."
git diff --cached --name-only -z --diff-filter=ACM | grep -z '\\.go$' | xargs -0 golangci-lint run --enable-only dupl --new=false --max-issues-per-linter=0 --max-same-issues=0
"""