Skip to content

Commit b3f7d8d

Browse files
authored
Improve pre-commit message (Azure#8360)
1 parent f1ca9b9 commit b3f7d8d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.githooks/pre-commit.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ foreach ($file in $files) {
2828
# Check if the file contains secrets
2929
$detected = $(azdev scan -f $file | ConvertFrom-Json).secrets_detected
3030
if ($detected -eq "True") {
31-
Write-Host "Detected secrets from $file. You can run 'azdev mask' to remove secrets before commit." -ForegroundColor Red
31+
Write-Host "Detected secrets from $file. Please run the following command to mask it:" -ForegroundColor Red
32+
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Red
33+
Write-Host "azdev mask -f $file" -ForegroundColor Red
34+
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Red
3235
$hasSecrets = 1
3336
}
3437
}

.githooks/pre-commit.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ for FILE in `git diff --cached --name-only --diff-filter=AM $against` ; do
2424
# Check if the file contains secrets
2525
detected=$(azdev scan -f "$FILE" | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
2626
if [ "$detected" = "True" ]; then
27-
printf "\033[0;31mDetected secrets from %s, You can run 'azdev mask' to remove secrets before commit.\033[0m\n" "$FILE"
27+
printf "\033[0;31mDetected secrets from %s, Please run the following command to mask it:\033[0m\n" "$FILE"
28+
printf "\033[0;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0m\n"
29+
printf "\033[0;31mazdev mask -f %s\033[0m\n" "$FILE"
30+
printf "\033[0;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0m\n"
2831
has_secrets=1
2932
fi
3033
done

0 commit comments

Comments
 (0)