mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
Pass any option to rubocop
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# While you are developing, you can call this script to check all
|
||||
# changed files. And then you can also tell Git to check before every
|
||||
# changed files. You can auto-correct them if you wish:
|
||||
#
|
||||
# ./script/rubocop-diff.sh -a
|
||||
#
|
||||
# And then you can also tell Git to check before every
|
||||
# commit by adding this line to your `.git/hooks/pre-commit` file:
|
||||
#
|
||||
# ./script/rubocop-diff.sh --cached || exit 1
|
||||
@@ -26,7 +30,12 @@
|
||||
#
|
||||
# The default binstub is still the safest, always using the bundled version.
|
||||
: ${RUBOCOP_BIN="`dirname $0`/../bin/rubocop"}
|
||||
cached="$1" # may be empty
|
||||
|
||||
if [ "$1" = "--cached" ]; then
|
||||
cached="$1"
|
||||
else
|
||||
rubocop_opt="$1"
|
||||
fi
|
||||
|
||||
if git diff $cached --diff-filter=ACMR HEAD --quiet; then
|
||||
# nothing changed
|
||||
@@ -39,4 +48,5 @@ exec git diff $cached --name-only --relative --diff-filter=ACMR HEAD |\
|
||||
--force-exclusion \
|
||||
--fail-level A \
|
||||
--format simple \
|
||||
--parallel --cache true
|
||||
--parallel --cache true \
|
||||
"$rubocop_opt"
|
||||
|
||||
Reference in New Issue
Block a user