diff --git a/xcode/aux_scripts/cpd_script.php b/xcode/aux_scripts/cpd_script.php index 4516660..d9a4746 100644 --- a/xcode/aux_scripts/cpd_script.php +++ b/xcode/aux_scripts/cpd_script.php @@ -1,5 +1,7 @@ duplication as $duplication) { +$CPD_XML_PATH = $argv[1]; + +foreach (simplexml_load_file($CPD_XML_PATH)->duplication as $duplication) { $files = $duplication->xpath('file'); foreach ($files as $file) { echo $file['path'].':'.$file['line'].':1: warning: '.$duplication['lines'].' copy-pasted lines from: ' diff --git a/xcode/build_phases/copy_paste_detection.sh b/xcode/build_phases/copy_paste_detection.sh index 01398a7..884e1c3 100644 --- a/xcode/build_phases/copy_paste_detection.sh +++ b/xcode/build_phases/copy_paste_detection.sh @@ -9,7 +9,7 @@ if which pmd >/dev/null; then pmd cpd --files ${SOURCES_DIR} --exclude ${FILES_TO_EXCLUDE} --minimum-tokens 50 --language swift --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > ${REPORTS_DIR}/cpd-output.xml --failOnViolation true # running script - php ./build-scripts/xcode/aux_scripts/cpd_script.php -cpd-xml ${REPORTS_DIR}/cpd-output.xml | tee ${REPORTS_DIR}/CPDLog.txt + php ./build-scripts/xcode/aux_scripts/cpd_script.php ${REPORTS_DIR}/cpd-output.xml | tee ${REPORTS_DIR}/CPDLog.txt else echo "warning: pmd not installed, install using 'brew install pmd'" exit 1