Framework: improve style-model pass

(cherry picked from commit 0f1b8b2666)
This commit is contained in:
Franco Fichtner 2025-07-02 10:45:40 +02:00
parent 4bc725e1b7
commit bbbe985b47
2 changed files with 11 additions and 7 deletions

View file

@ -44,7 +44,7 @@ list:
.endfor
# shared targets that are sane to run from the root directory
TARGETS= clean glint lint plist-fix revision style style-fix style-python sweep test
TARGETS= clean glint lint plist-fix revision style style-fix style-model style-python sweep test
.for TARGET in ${TARGETS}
${TARGET}:

View file

@ -453,12 +453,16 @@ style-python: check
fi
style-model:
@for MODEL in $$(find ${.CURDIR}/src/opnsense/mvc/app/models -depth 3 \
-name "*.xml"); do \
perl -i -pe 's/<default>(.*?)<\/default>/<Default>$$1<\/Default>/g' $${MODEL}; \
perl -i -pe 's/<multiple>(.*?)<\/multiple>/<Multiple>$$1<\/Multiple>/g' $${MODEL}; \
perl -i -pe 's/<required>(.*?)<\/required>/<Required>$$1<\/Required>/g' $${MODEL}; \
done
@if [ -d ${.CURDIR}/src/opnsense/mvc/app/models ]; then \
for MODEL in $$(find ${.CURDIR}/src/opnsense/mvc/app/models -depth 3 \
-name "*.xml"); do \
perl -i -pe 's/<default>(.*?)<\/default>/<Default>$$1<\/Default>/g' $${MODEL}; \
perl -i -pe 's/<multiple>(.*?)<\/multiple>/<Multiple>$$1<\/Multiple>/g' $${MODEL}; \
perl -i -pe 's/<required>(.*?)<\/required>/<Required>$$1<\/Required>/g' $${MODEL}; \
perl -i -pe 's/<mask>(.*?)<\/mask>/<Mask>$$1<\/Mask>/g' $${MODEL}; \
perl -i -pe 's/<asList>(.*?)<\/asList>/<AsList>$$1<\/AsList>/g' $${MODEL}; \
done; \
fi
test: check
@if [ -d ${.CURDIR}/src/opnsense/mvc/tests ]; then \