diff options
| author | Sjors Provoost <[email protected]> | 2018-01-05 14:40:46 +0100 |
|---|---|---|
| committer | Sjors Provoost <[email protected]> | 2018-01-05 14:41:01 +0100 |
| commit | 40b17f5f9106e572420dada04c15ec452a8f4f41 (patch) | |
| tree | 2390f37bb3afa26b74381066f45d7f807a3c8525 | |
| parent | Merge #12093: Fix incorrect Markdown link (diff) | |
| download | discoin-40b17f5f9106e572420dada04c15ec452a8f4f41.tar.xz discoin-40b17f5f9106e572420dada04c15ec452a8f4f41.zip | |
[scripts] lint-whitespace: use perl instead of grep -P
MacOS does not support 'grep -P' out of the box. This change makes
it easier for developers to check for whitespace problems locally.
| -rwxr-xr-x | contrib/devtools/lint-whitespace.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/devtools/lint-whitespace.sh b/contrib/devtools/lint-whitespace.sh index 989923f31..4c6758835 100755 --- a/contrib/devtools/lint-whitespace.sh +++ b/contrib/devtools/lint-whitespace.sh @@ -59,7 +59,7 @@ if showdiff | grep -E -q '^\+.*\s+$'; then fi # Check if tab characters were found in the diff. -if showcodediff | grep -P -q '^\+.*\t'; then +if showcodediff | perl -nle '$MATCH++ if m{^\+.*\t}; END{exit 1 unless $MATCH>0}' > /dev/null; then echo "This diff appears to have added new lines with tab characters instead of spaces." echo "The following changes were suspected:" FILENAME="" @@ -81,7 +81,7 @@ if showcodediff | grep -P -q '^\+.*\t'; then fi echo "$line" fi - done < <(showcodediff | grep -P '^(diff --git |@@|\+.*\t)') + done < <(showcodediff | perl -nle 'print if m{^(diff --git |@@|\+.*\t)}') RET=1 fi |