#! /bin/bash
#
# This script will run some other scripts to generate reports.
#
# @later	find a decent way to run multiple processes at once (maybe use `wait`)
# @version	1.0.0
# @author	Tijs Verkoyen <tijs@sumocoders.be>

# create folder
mkdir -p reports

# tell user
echo "* Running PHP Code Sniffer (will take a while)"

# run PHP Code Sniffer
phpcs --standard=./codesniffer/Fork --ignore=../default_www/backend/core/js/tiny_mce,../default_www/frontend/cache,../default_www/backend/cache,../default_www/install/cache,../default_www/docs,../default_www/markup,../tools,../library/external --extensions=php --report=xml ../ > ./reports/phpcs.xml

# tell user
echo "* Running PHP Mess Detection (will take a while)"

# run PHP Mess Detection
phpmd ../ xml codesize,unusedcode,naming --exclude ../default_www/backend/core/js/tiny_mce,../default_www/frontend/cache,../default_www/backend/cache,../default_www/install/cache,../default_www/docs,../default_www/markup,../tools,../library/external --reportfile ./reports/phpmd.xml

# tell user
echo "* Running PHP Depend (will take a while)"

# run PHP Depend
pdepend --jdepend-chart=./reports/pdepend_chart.svg --overview-pyramid=./reports/pdepend_pyramid.svg --summary-xml=./reports/pdepend.xml --suffix=php --ignore=../default_www/backend/core/js/tiny_mce,../default_www/frontend/cache,../default_www/backend/cache,../default_www/install/cache,../default_www/docs,../default_www/markup,../tools,../library/external ../ > /dev/null

# tell user
echo "* Running PHP Loc"

# run PHP Loc
phploc --log-xml ./reports/phploc.xml --suffixes php ../ > /dev/null

# tell user
echo "Done"