-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
289 lines (229 loc) · 7.35 KB
/
justfile
File metadata and controls
289 lines (229 loc) · 7.35 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# Singularity Analysis Engine - Quality Justfile
# Run with: just quality
# Default recipe (shows help)
default:
@just --list
# Run all quality checks (Rust + Elixir + Security + CLI analysis)
quality: rust-quality elixir-quality security duplication cli-quality-check
@echo "✅ All quality checks completed!"
# === RUST QUALITY CHECKS ===
# Run all Rust quality checks
rust-quality: rust-fmt rust-clippy rust-audit rust-deny rust-outdated rust-machete
@echo "✅ Rust quality checks passed!"
# Check Rust formatting
rust-fmt:
@echo "🦀 Checking Rust formatting..."
cargo fmt --check
# Run Clippy with pedantic + nursery + cargo lints
rust-clippy:
@echo "🦀 Running Clippy (pedantic + nursery)..."
cargo clippy --workspace --all-targets --all-features -- \
-D warnings \
-D clippy::all \
-D clippy::pedantic \
-D clippy::nursery \
-D clippy::cargo
# Security audit
rust-audit:
@echo "🦀 Running cargo-audit..."
cargo audit
# Dependency checks (licenses, bans, advisories)
rust-deny:
@echo "🦀 Running cargo-deny..."
cargo deny check
# Check for outdated dependencies
rust-outdated:
@echo "🦀 Checking outdated dependencies..."
cargo outdated
# Find unused dependencies
rust-machete:
@echo "🦀 Finding unused dependencies..."
cargo machete
# Detect unsafe code usage
rust-geiger:
@echo "🦀 Detecting unsafe code..."
cargo geiger
# Find unused dependencies (build-time, requires nightly)
rust-udeps:
@echo "🦀 Finding unused dependencies (nightly)..."
cargo +nightly udeps --workspace
# === ELIXIR QUALITY CHECKS ===
# Run all Elixir quality checks
elixir-quality: elixir-fmt elixir-credo elixir-doctor elixir-sobelow elixir-audit
@echo "✅ Elixir quality checks passed!"
# Check Elixir formatting
elixir-fmt:
@echo "💜 Checking Elixir formatting..."
mix format --check-formatted
# Run Credo (strict mode)
elixir-credo:
@echo "💜 Running Credo (strict)..."
mix credo --strict
# Check documentation coverage
elixir-doctor:
@echo "💜 Checking documentation coverage..."
mix doctor
# Security scan with Sobelow
elixir-sobelow:
@echo "💜 Running Sobelow security scan..."
mix sobelow --config
# Audit dependencies for vulnerabilities
elixir-audit:
@echo "💜 Auditing dependencies..."
mix deps.audit
# Run Dialyzer type checking
elixir-dialyzer:
@echo "💜 Running Dialyzer..."
mix dialyzer
# === SECURITY SCANS ===
# Run all security scans
security: gitleaks rust-audit rust-deny rust-geiger elixir-sobelow elixir-audit
@echo "✅ Security scans completed!"
# Scan for secrets and credentials
gitleaks:
@echo "🔒 Scanning for secrets..."
gitleaks detect --no-git
# Lint shell scripts
shellcheck:
@echo "🔒 Linting shell scripts..."
find . -name "*.sh" -not -path "./deps/*" -not -path "./_build/*" -not -path "./target/*" -exec shellcheck {} \;
# === CODE QUALITY & ANALYSIS ===
# Detect duplicate code (requires: npm install -g jscpd)
duplication:
@echo "📊 Detecting duplicate code..."
@if command -v jscpd >/dev/null 2>&1; then \
jscpd .; \
else \
echo "⚠️ jscpd not installed. Run: npm install -g jscpd"; \
fi
# Code statistics
stats:
@echo "📈 Code statistics..."
@tokei
# === TESTING & COVERAGE ===
# Run all tests
test:
@echo "🧪 Running tests..."
@echo " → Rust tests"
cargo nextest run --workspace --all-features
@echo " → Elixir tests"
mix test
# Generate coverage reports
coverage: coverage-rust coverage-elixir
@echo "✅ Coverage reports generated!"
@echo " • Rust: coverage/rust/index.html"
@echo " • Elixir: cover/excoveralls.html"
# Rust coverage
coverage-rust:
@echo "📊 Generating Rust coverage..."
cargo tarpaulin --out Html --output-dir coverage/rust
# Elixir coverage
coverage-elixir:
@echo "📊 Generating Elixir coverage..."
mix coveralls.html
# === FORMATTING ===
# Format all code
fmt: rust-fmt-fix elixir-fmt-fix
@echo "✅ All code formatted!"
# Fix Rust formatting
rust-fmt-fix:
@echo "🦀 Formatting Rust code..."
cargo fmt
# Fix Elixir formatting
elixir-fmt-fix:
@echo "💜 Formatting Elixir code..."
mix format
# === MAINTENANCE ===
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
cargo clean
mix clean
rm -rf _build deps .mix .cargo .sccache
rm -rf coverage cover reports
@echo "✅ Clean completed!"
# Update dependencies
update:
@echo "📦 Updating dependencies..."
@echo " → Rust dependencies"
cargo update
@echo " → Elixir dependencies"
mix deps.update --all
# === CI/CD SIMULATION ===
# Run CI pipeline (all checks + tests + coverage)
ci: quality test coverage
@echo "✅ CI pipeline completed successfully!"
# Pre-commit checks (fast, essential only)
pre-commit:
@echo "🚀 Running pre-commit checks..."
cargo fmt --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
mix format --check-formatted
mix credo
gitleaks detect --no-git
@echo "✅ Pre-commit checks passed!"
# === PERFORMANCE ANALYSIS ===
# Analyze binary size
bloat:
@echo "📊 Analyzing binary size..."
cargo bloat --release --features cli
# Count LLVM IR lines
llvm-lines:
@echo "📊 Counting LLVM IR lines..."
cargo llvm-lines
# Expand macros
expand:
@echo "🔍 Expanding macros..."
cargo expand
# === CLI BUILD & RUN ===
# Build the CLI binary (library + CLI features)
build-cli:
@echo "🔨 Building singularity-rca CLI binary..."
cargo build --release --features cli
# Run quality analysis using the CLI (after building)
cli-quality-check:
@echo "🔍 Running CLI-based quality analysis..."
@if cargo build --release --features cli 2>/dev/null; then \
echo " → Analyzing src/ with singularity-rca..."; \
./target/release/singularity-rca analyze src/ --recursive --format table 2>/dev/null || echo " ⚠️ CLI analysis skipped (implementation pending)"; \
else \
echo " ⚠️ CLI build skipped (optional feature)"; \
fi
# Build library only (no CLI)
build-lib:
@echo "🔨 Building library..."
cargo build --release
# Build with all features
build-all:
@echo "🔨 Building all features..."
cargo build --release --all-features
# Install CLI binary
install-cli:
@echo "📦 Installing singularity-rca CLI..."
cargo install --path . --features cli
# Run CLI (analyze current directory)
run-cli PATH="." *ARGS="":
@echo "🚀 Running CLI..."
cargo run --features cli -- analyze {{PATH}} {{ARGS}}
# Show CLI help
cli-help:
@echo "📖 CLI Help:"
cargo run --features cli -- --help
# CLI: Analyze file or directory
cli-analyze PATH *ARGS="":
cargo run --features cli -- analyze {{PATH}} {{ARGS}}
# CLI: Show metrics for a file
cli-metrics FILE *ARGS="":
cargo run --features cli -- metrics {{FILE}} {{ARGS}}
# CLI: List supported languages
cli-languages:
cargo run --features cli -- languages
# CLI: Check complexity
cli-complexity PATH *ARGS="":
cargo run --features cli -- complexity {{PATH}} {{ARGS}}
# CLI: Generate report
cli-report PATH *ARGS="":
cargo run --features cli -- report {{PATH}} {{ARGS}}
# CLI: Compare two versions
cli-compare PATH1 PATH2 *ARGS="":
cargo run --features cli -- compare {{PATH1}} {{PATH2}} {{ARGS}}