make: add a lint pass for model default values

This commit is contained in:
Franco Fichtner 2023-08-31 09:40:33 +02:00
parent c6fbcf1e4d
commit e22ea99d12

View File

@ -360,6 +360,14 @@ lint-xml:
@find ${.CURDIR}/src ${.CURDIR}/Scripts \
-name "*.xml*" -type f -print0 | xargs -0 -n1 xmllint --noout
lint-model:
@for MODEL in $$(find ${.CURDIR}/src/opnsense/mvc/app/models -depth 3 \
-name "*.xml"); do \
(xmllint $${MODEL} --xpath '//*[@type and not(@type="ArrayField") and (not(Required) or Required="N") and default]' 2> /dev/null | grep '^<' || true) | while read LINE; do \
echo "$${MODEL}: $${LINE} has a spurious default value set"; \
done; \
done
SCRIPTDIRS!= find ${.CURDIR}/src/opnsense/scripts -type d -depth 1
lint-exec:
@ -377,7 +385,7 @@ LINTBIN?= ${.CURDIR}/contrib/parallel-lint/parallel-lint
lint-php:
@${LINTBIN} src
lint: plist-check lint-shell lint-xml lint-exec lint-php
lint: plist-check lint-shell lint-xml lint-model lint-exec lint-php
sweep:
find ${.CURDIR}/src -type f -name "*.map" -print0 | \