add style and style-fix targets

This commit is contained in:
Franco Fichtner 2016-10-21 19:59:26 +02:00
parent 3efe3c46cf
commit d1885b47e6
3 changed files with 31 additions and 0 deletions

View file

@ -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

View file

@ -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

8
ruleset.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<ruleset name="PSR2+">
<description>Slightly enhanced version of the PSR2 standard</description>
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<rule ref="PSR2"/>
<exclude-pattern>*.css</exclude-pattern>
<exclude-pattern>*.js</exclude-pattern>
</ruleset>