pass CPD_XML_PATH to cpd_script.php

This commit is contained in:
Ivan Smolin 2020-04-01 13:39:19 +03:00
parent ab666b6a57
commit 2fbfcf3d59
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
<?php
foreach (simplexml_load_file('cpd-output.xml')->duplication as $duplication) {
$CPD_XML_PATH = $argv[2];
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: '

View File

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