Files
iNaturalistReactNative/.husky/pre-commit
Ken-ichi e1bc1626d9 chore: lint Ruby files with Rubocop (#2435)
* fix: set up Ruby before linting in Github Actions
* chore: separate linting from fixing

Before we commit we want to fix as much as possible, but when we're checking a
pull request we're not going to commit anything so we want to know about all
the problems, including the fixable ones.
2024-11-18 21:27:20 -08:00

27 lines
849 B
Plaintext
Executable File

# If ggshield is installed, run it
if command -v ggshield &> /dev/null; then
ggshield secret scan pre-commit
# Otherwise require that inaturalist.org git users install it
elif git config --list | grep -q "user.email.*inaturalist.org"; then
echo
echo "Git users w/ inaturalist.org emails must install ggshield: https://docs.gitguardian.com/ggshield-docs/getting-started"
echo
exit 1
else
echo
echo "If you are iNat staff, you should install ggshield: https://docs.gitguardian.com/ggshield-docs/getting-started"
echo
fi
# Run lint and flow
npm run lint:fix
# Generate translations from strings.ftl
npm run translate
# ...and add them to the commit; this assumes src/i18n/l10n/ *only* contains
# files you want to add
git status --porcelain --untracked-files src/i18n/l10n/ \
| grep -v "D .*" \
| cut -c 4- \
| xargs git add