Fix typo and remove code hook for l10n

This commit is contained in:
Neeraj Gupta 2023-06-16 12:33:02 +05:30
parent d1724060df
commit 0a3a24d668
2 changed files with 2 additions and 32 deletions

View file

@ -1,37 +1,9 @@
#!/bin/sh
# This git hook fails if a user is trying to add a new file which is
# not null safe.
exec ./hooks/pre-commit-fdroid
# Check the contents of each file that is being added(A) or modified(N) or
# copied (C)
for file in `git diff --name-only --diff-filter=ACM --cached`; do
# Ignore the hooks from any pre-commit check
if echo "$file" | grep -q 'hooks/'; then
continue
fi
# Get the contents of the newly added lines in the file
newContent=`git diff --cached --unified=0 $file | grep '^+'`
oldContent=`git diff --cached --unified=0 $file | grep '^-'`
initialContent=`head -5 $file`
# Check if user has added "// @dart=2.9" in the file
if echo "$newContent" | grep -q '// @dart=2.9'; then
echo "😡 File $file looks like a newly created file but it's not null-safe"
exit 1
elif echo "$oldContent" | grep -q '// @dart=2.9'; then
echo "💚💚 Thank you for making $file null-safe"
continue
elif echo "$initialContent" | grep -q '// @dart=2.9'; then
echo "🔥🔥🔥🔥 Please make $file null-safe"
continue
else
continue
fi
done
nullUnsafeFiles=$(grep '// @dart=2.9' -r lib/ | wc -l)
# The xargs at the end is to trim whitepsaces https://stackoverflow.com/a/12973694/546896
echo "🥺🥺 $nullUnsafeFiles files are still waiting for their nullSafety migrator" | xargs
# If the script gets to this point, all files passed the check
exit 0

View file

@ -1,11 +1,9 @@
#!/bin/sh
# Get the current branch
current_branch=$(git rev-parse --abbrev-ref HEAD)
# If the current branch is f-droid, echo Hello World
if [ "$current_branch" = "f-droid" ]; then
# Verify that the pubspec.yaml doesn't contain certain words
# Verify that the pubspec.yaml doesn't contain certain dependencies
WORDS=("in_app_purchase" "firebase")
for word in ${WORDS[@]}; do
if grep -q $word pubspec.yaml; then