diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh index b0def6937..d9987d556 100755 --- a/scripts/analysis/analysis-wrapper.sh +++ b/scripts/analysis/analysis-wrapper.sh @@ -8,6 +8,8 @@ #6: DRONE_BUILD_NUMBER #7: PULL_REQUEST_NUMBER +stableBranch="master" + ruby scripts/analysis/lint-up.rb $1 $2 $3 lintValue=$? @@ -50,11 +52,28 @@ else done # add comment with results - lintResultNew=$(grep "Lint Report.* [0-9]* warnings" app/build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<') - lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ") - lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ") - lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ") - lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ") + lintResultNew=$(grep "Lint Report.* [0-9]* warning" app/build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<') + + lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ") + if ( [ -z $lintErrorNew ] ); then + lintErrorNew=0 + fi + + lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ") + if ( [ -z $lintWarningNew ] ); then + lintWarningNew=0 + fi + + lintResultOld=$(curl 2>/dev/null https://raw.githubusercontent.com/nextcloud/talk-android/$stableBranch/scripts/analysis/lint-results.txt) + lintErrorOld=$(echo $lintResultOld | grep "[0-9]* error" -o | cut -f1 -d" ") + if ( [ -z $lintErrorOld ] ); then + lintErrorOld=0 + fi + + lintWarningOld=$(echo $lintResultOld | grep "[0-9]* warning" -o | cut -f1 -d" ") + if ( [ -z $lintWarningOld ] ); then + lintWarningOld=0 + fi lintResult="

Lint

TypeMasterPR
Warnings"$lintWarningOld""$lintWarningNew"
Errors"$lintErrorOld""$lintErrorNew"
" findbugsResultNew=$(sed -n "/

Summary<\/h1>/,/

Warnings<\/h1>/p" app/build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'///'g | sed s"#Summary#FindBugs (new)#" | tr "\"" "\'" | tr -d "\n") findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/talk-findbugs/findbugs-summary-master.html | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#FindBugs#'| tr "\"" "\'" | tr -d "\n")