mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-02 06:26:26 -04:00
Add locale-key-propagater and auto linter hooks
This commit is contained in:
parent
c85c6d0ac5
commit
2e6adfb44a
2 changed files with 100 additions and 0 deletions
23
scripts/git/pre-commit
Normal file
23
scripts/git/pre-commit
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Useful precomit hooks
|
||||
# Please see https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks for instructions on installation.
|
||||
|
||||
# Crystal linter
|
||||
# This is a modified version of the pre-commit hook from the crystal repo. https://github.com/crystal-lang/crystal/blob/master/scripts/git/pre-commit
|
||||
# Please refer to that if you'd like an version that doesn't automatically format staged files.
|
||||
changed_cr_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.cr$')
|
||||
if [ ! -z "$changed_cr_files" ]; then
|
||||
if [ -x bin/crystal ]; then
|
||||
# use bin/crystal wrapper when available to run local compiler build
|
||||
bin/crystal tool format $changed_cr_files >&2
|
||||
else
|
||||
crystal tool format $changed_cr_files >&2
|
||||
fi
|
||||
|
||||
git add $changed_cr_files
|
||||
fi
|
||||
|
||||
# Locale equalizer
|
||||
if [ ! -z $(git diff --name-only --cached -- locales/) ]; then
|
||||
crystal run scripts/propagate-new-locale-keys.cr
|
||||
git add locales > /dev/null
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue