Move long lines check to PHP_CodeSniffer

This commit is contained in:
Zach Borboa
2023-07-01 06:43:39 -07:00
parent 5f5b94871d
commit 314f373a17
2 changed files with 7 additions and 8 deletions
-8
View File
@@ -76,14 +76,6 @@ if [[ ! -z "${trailing_whitespace}" ]]; then
errors+=("${result}")
fi
# Prohibit long lines in php files.
long_lines=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" ! -path "*/www/*" -exec awk '{print FILENAME":"NR" "length}' {} \; | awk '$2 > 120')
if [[ ! -z "${long_lines}" ]]; then
result="$(echo -e "${long_lines}" | perl -pe 's/^(.*)$/Long lines found in \1/')"
echo "${result}"
errors+=("${result}")
fi
# Require identical comparison operators (===, not ==) in php files.
equal=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --color=always --extended-regexp --line-number -H "[^!=]==[^=]" {} \;)
if [[ ! -z "${equal}" ]]; then
+7
View File
@@ -18,6 +18,13 @@
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
</rule>
<!-- Prohibit long lines in php files. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<!-- Disable "No PHP code was found in this file" for symlinks. -->
<rule ref="Internal.NoCodeFound">
<severity>0</severity>