Add --color=always to grep and egrep commands

This commit is contained in:
Zach Borboa
2016-08-19 00:37:32 -07:00
parent 18b5ad7e78
commit 30b9bcb76b
+4 -4
View File
@@ -10,14 +10,14 @@ if [[ "${?}" -ne 0 ]]; then
fi
# Enforce line ending consistency in php files.
crlf_file=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --files-with-matches $'\r' {} \;)
crlf_file=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --color=always --files-with-matches $'\r' {} \;)
if [[ ! -z "${crlf_file}" ]]; then
echo "${crlf_file}" | perl -pe 's/(.*)/CRLF line terminators found in \1/'
((errors++))
fi
# Enforce indentation character consistency in php files.
tab_char=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --line-number -H --perl-regexp "\t" {} \;)
tab_char=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --color=always --line-number -H --perl-regexp "\t" {} \;)
if [[ ! -z "${tab_char}" ]]; then
echo -e "${tab_char}" | perl -pe 's/^(.*)$/Tab character found in \1/'
((errors++))
@@ -60,7 +60,7 @@ if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]]; then
fi
# Prohibit trailing whitespace in php files.
trailing_whitespace=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --line-number -H " +$" {} \;)
trailing_whitespace=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H " +$" {} \;)
if [[ ! -z "${trailing_whitespace}" ]]; then
echo -e "${trailing_whitespace}" | perl -pe 's/^(.*)$/Trailing whitespace found in \1/'
((errors++))
@@ -74,7 +74,7 @@ if [[ ! -z "${long_lines}" ]]; then
fi
# Prohibit @author in php files.
at_author=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --line-number -H "@author" {} \;)
at_author=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H "@author" {} \;)
if [[ ! -z "${at_author}" ]]; then
echo -e "${at_author}" | perl -pe 's/^(.*)$/\@author found in \1/'
((errors++))