Skip to content

Commit

Permalink
Merge pull request #76 from loadsys/f/add-phpmetrics
Browse files Browse the repository at this point in the history
F/add phpmetrics
  • Loading branch information
beporter committed Apr 12, 2016
2 parents a6b3c6e + 29f5d65 commit 9ab907c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"phpdocumentor/phpdocumentor": "~2.0",
"psy/psysh": "@stable",
"loadsys/loadsys_codesniffer": "~3.0",
"nikic/php-parser": "~0.9"
"nikic/php-parser": "~0.9",
"phpmetrics/phpmetrics": "^1.10"
},
"config": {
"bin-dir": "bin"
Expand All @@ -39,6 +40,7 @@
"git-localchanges",
"git-remotechanges",
"logs-clear",
"metrics-generate",
"migrations",
"nfsexports-setsudoaccess",
"owner-set",
Expand Down
45 changes: 45 additions & 0 deletions metrics-generate
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Wraps up the call to the PHPMetrics library for standard Cake
project folder layouts. Writes reports into the tmp/metrics/
folder.
Should be run from the project root folder.
Usage:
bin/${0##*/}
EOT

exit ${1:-0} # Exit with code 0 unless an arg is passed to the method.
}
if [ "$1" = '-h' ]; then
usage
fi


# Set up local variables.
umask a+rw

DIR="$( cd -P "$( dirname "$0" )"/.. >/dev/null 2>&1 && pwd )"
TMP_DIR="tmp"
REPORT_DIR="${TMP_DIR}/metrics"
REPORT_FILE="${REPORT_DIR}/index.html"
TARGET_FOLDERS=("./src")

if [ $# -gt 0 ]; then
TARGET_FOLDERS=("$@")
fi


echo "## Generating metrics report.";
bin/phpmetrics \
--report-html="$REPORT_FILE" \
${TARGET_FOLDERS[@]}

0 comments on commit 9ab907c

Please sign in to comment.