Sebastian Kippe f639e3aa19
Add pre-commit hook and setup script (#129)
Add pre-commit hook and setup script

Runs the appropriate linter on staged files before committing.
2019-06-09 13:53:40 +02:00

18 lines
438 B
Bash
Executable File

#!/bin/sh
#
# Run appropriate linter against staged files
#
if [ $(git diff --name-only --cached lib/ | wc -l) != 0 ]; then
./node_modules/.bin/eslint lib/
if [ $? != 0 ]; then
exit 1
fi
fi
# TODO master not linted yet, uncomment this when ready
# if [ $(git diff --name-only --cached contracts/ | wc -l) != 0 ]; then
# solhint contracts/**/*.sol && apps/*/contracts/**/*.sol
# if [ $? != 0 ]; then
# exit 1
# fi
# fi