v0.1.0 skel
This commit is contained in:
44
scripts/check_banned_crates.sh
Executable file
44
scripts/check_banned_crates.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/check_banned_crates.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
echo "[check_banned_crates] scanning Cargo.toml files..."
|
||||
|
||||
FAILED=0
|
||||
|
||||
# Scan uniquement les Cargo.toml
|
||||
while IFS= read -r file; do
|
||||
if grep -nE '\b(anyhow|thiserror)\b' "$file"; then
|
||||
echo "[check_banned_crates] banned crate found in $file"
|
||||
FAILED=1
|
||||
fi
|
||||
done < <(find "$ROOT_DIR" \
|
||||
-type f \
|
||||
-name "Cargo.toml" \
|
||||
-not -path "*/target/*" \
|
||||
-not -path "*/.git/*" \
|
||||
-not -path "*/.cargo/*")
|
||||
|
||||
# Optionnel : scan des imports Rust
|
||||
echo "[check_banned_crates] scanning Rust sources..."
|
||||
|
||||
while IFS= read -r file; do
|
||||
if grep -nE '\b(anyhow|thiserror)\b' "$file"; then
|
||||
echo "[check_banned_crates] banned crate reference in $file"
|
||||
FAILED=1
|
||||
fi
|
||||
done < <(find "$ROOT_DIR" \
|
||||
-type f \
|
||||
-name "*.rs" \
|
||||
-not -path "*/target/*" \
|
||||
-not -path "*/.git/*")
|
||||
|
||||
if [ "$FAILED" -ne 0 ]; then
|
||||
echo "[check_banned_crates] FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[check_banned_crates] ok"
|
||||
Reference in New Issue
Block a user