diff --git a/Makefile b/Makefile index 08b0b889d..868c43188 100644 --- a/Makefile +++ b/Makefile @@ -30,3 +30,13 @@ sweep: .for PLUGIN_DIR in ${PLUGIN_DIRS} ${MAKE} -C ${PLUGIN_DIR} sweep .endfor + +style: +.for PLUGIN_DIR in ${PLUGIN_DIRS} + ${MAKE} -C ${PLUGIN_DIR} style +.endfor + +style-fix: +.for PLUGIN_DIR in ${PLUGIN_DIRS} + ${MAKE} -C ${PLUGIN_DIR} style-fix +.endfor diff --git a/Mk/plugins.mk b/Mk/plugins.mk index a11dbcbe8..cac34e282 100644 --- a/Mk/plugins.mk +++ b/Mk/plugins.mk @@ -204,4 +204,17 @@ sweep: check ! -name "*.ser" -type f -print0 | \ xargs -0 -n1 ${.CURDIR}/../../Scripts/cleanfile +style: check + @(phpcs --standard=${.CURDIR}/../../ruleset.xml ${.CURDIR}/src \ + || true) > ${.CURDIR}/.style.out + @echo -n "Total number of style warnings: " + @grep '| WARNING' ${.CURDIR}/.style.out | wc -l + @echo -n "Total number of style errors: " + @grep '| ERROR' ${.CURDIR}/.style.out | wc -l + @cat ${.CURDIR}/.style.out + @rm ${.CURDIR}/.style.out + +style-fix: check + phpcbf --standard=${.CURDIR}/../../ruleset.xml ${.CURDIR}/src || true + .PHONY: check diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 000000000..be1f5f860 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,8 @@ + + + Slightly enhanced version of the PSR2 standard + + + *.css + *.js +