Skip to content

Commit

Permalink
go/lint: gitleaks dir by dir only when GITLEAKS_EXCLUDE is set
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Oct 1, 2024
1 parent 22cc991 commit 329ac14
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions go/lint-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,18 @@ if [[ "$run_gitleaks" == "true" ]]; then
echo "gitleaks version: "$(./bin/gitleaks version)

# Find directories and optionally exclude one
dirs=($(find . -mindepth 1 -type d | sort -u | grep -v ".git"))
if [ -n "$GITLEAKS_EXCLUDE" ]; then
dirs=($(find . -mindepth 1 -type d | sort -u | grep -v ".git"))
dirs=($(printf "%s\n" "${dirs[@]}" | grep -v "$GITLEAKS_EXCLUDE"))

for dir in "${dirs[@]}"; do
echo "Running gitleaks on $dir"
./bin/gitleaks detect --no-git --verbose --no-banner --source "$dir"
done
else
./bin/gitleaks detect --no-git --verbose
fi

for dir in "${dirs[@]}"; do
echo "Running gitleaks on $dir"
./bin/gitleaks detect --no-git --verbose --no-banner --source "$dir"
done
echo "FINISHED gitleaks check"
fi

Expand Down

0 comments on commit 329ac14

Please sign in to comment.