fix multiline warnings

This commit is contained in:
Ivan Smolin 2020-04-01 16:07:36 +03:00
parent a8284d136e
commit 1a5abfc580
1 changed files with 4 additions and 4 deletions

View File

@ -8,12 +8,12 @@ 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
readonly WARNINGS=$(php ./build-scripts/xcode/aux_scripts/cpd_script.php ${REPORTS_DIR}/cpd-output.xml)
php ./build-scripts/xcode/aux_scripts/cpd_script.php ${REPORTS_DIR}/cpd-output.xml | tee ${REPORTS_DIR}/CPDLog.txt
# Make paths relative to SOURCES_DIR, so different developers won't rewrite entire file
readonly SED_REPLACEMENT_STRING=$(echo ${SOURCES_DIR} | sed "s/\//\\\\\//g")
echo ${WARNINGS} | sed "s/${SED_REPLACEMENT_STRING}//" > ${REPORTS_DIR}/CPDLog.txt
echo ${WARNINGS}
sed -i '' "s/${SED_REPLACEMENT_STRING}//g" "${REPORTS_DIR}/CPDLog.txt"
else
echo "warning: pmd not installed, install using 'brew install pmd'"
exit 1