mirror of
https://github.com/opnsense/core.git
synced 2026-05-28 04:34:51 -04:00
Scripts: add instanceof syntax for import linter
This commit is contained in:
parent
7cfb03be5d
commit
4f7fccd93e
1 changed files with 4 additions and 1 deletions
|
|
@ -34,7 +34,10 @@ fi
|
|||
for FILE in $(find src -name "*.php"); do
|
||||
for IMPORT in $(grep -iE 'use [a-z0-9_\\]+\\[^;\\]+;' ${FILE} | awk '{ print $2 }' | tr -d ';'); do
|
||||
CLASS=${IMPORT##*\\}
|
||||
if [ "$(grep -c -e "new ${CLASS}" -e "${CLASS}::" -e "extends ${CLASS}" ${FILE})" = "0" ]; then
|
||||
if [ "$(grep -c -e "instanceof ${CLASS}" \
|
||||
-e "new ${CLASS}" \
|
||||
-e "${CLASS}::" \
|
||||
-e "extends ${CLASS}" ${FILE})" = "0" ]; then
|
||||
echo "${FILE}: warning: stale import \`${IMPORT}'"
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in a new issue