summaryrefslogtreecommitdiffstats
path: root/misc/scripts/dotnet_format.sh
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-02-02 12:10:02 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-02-02 15:10:46 +0100
commit6da378afeaaec007d761113198bdd6c0966eafa7 (patch)
tree0672ba0edef5b74c1144a0df99dc601fcdce0ef9 /misc/scripts/dotnet_format.sh
parent10e111477db68fe65776a1d68fb1ffccaf6520fc (diff)
downloadredot-engine-6da378afeaaec007d761113198bdd6c0966eafa7.tar.gz
Fix `printf` for format checks
Prevents errors with input being invalid format strings
Diffstat (limited to 'misc/scripts/dotnet_format.sh')
-rwxr-xr-xmisc/scripts/dotnet_format.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh
index cac00f5cb1..e2b4ba5e43 100755
--- a/misc/scripts/dotnet_format.sh
+++ b/misc/scripts/dotnet_format.sh
@@ -31,7 +31,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1