mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 05:05:31 +03:00
use spotbugs for analytics
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
7cba1afd12
commit
20802780c7
4 changed files with 15 additions and 14 deletions
|
@ -219,6 +219,7 @@ android {
|
|||
reportLevel = "medium"
|
||||
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/compile${capVariantName}JavaWithJavac/classes/")
|
||||
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
|
||||
pluginClasspath = project.configurations.spotbugsPlugins
|
||||
source = fileTree('src/main/java')
|
||||
classpath = files()
|
||||
include '**/*.java'
|
||||
|
@ -308,8 +309,8 @@ dependencies {
|
|||
|
||||
androidTestImplementation 'tools.fastlane:screengrab:1.2.0'
|
||||
|
||||
findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
|
||||
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3'
|
||||
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
|
||||
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3.sb'
|
||||
|
||||
implementation 'com.google.dagger:dagger:2.21'
|
||||
implementation 'com.google.dagger:dagger-android:2.21'
|
||||
|
|
|
@ -26,9 +26,9 @@ echo "Branch: $3"
|
|||
|
||||
if [ $3 = $stableBranch ]; then
|
||||
echo "New findbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html"
|
||||
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file build/reports/findbugs/findbugs.html
|
||||
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file build/reports/spotbugs/spotbugs.html
|
||||
|
||||
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"/Summary/FindBugs ($stableBranch)/" | tr "\"" "\'" | tr -d "\r\n")
|
||||
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/spotbugs/spotbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"/Summary/FindBugs ($stableBranch)/" | tr "\"" "\'" | tr -d "\r\n")
|
||||
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/findbugs-summary-$stableBranch.html
|
||||
|
||||
if [ $lintValue -ne 1 ]; then
|
||||
|
@ -44,7 +44,7 @@ else
|
|||
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$6.html --upload-file build/reports/lint/lint.html
|
||||
|
||||
echo "New findbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html"
|
||||
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$6.html --upload-file build/reports/findbugs/findbugs.html
|
||||
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$6.html --upload-file build/reports/spotbugs/spotbugs.html
|
||||
|
||||
# delete all old comments
|
||||
oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|")
|
||||
|
@ -68,8 +68,8 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -s build/reports/findbugs/findbugs.html ] ; then
|
||||
echo "findbugs.html file is missing!"
|
||||
if [ ! -s build/reports/spotbugs/spotbugs.html ] ; then
|
||||
echo "spotbugs.html file is missing!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -98,8 +98,8 @@ else
|
|||
fi
|
||||
|
||||
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/"$repository"-lint/"$stableBranch".html'>$stableBranch</a></td><td><a href='https://www.kaminsky.me/nc-dev/"$repository"-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
|
||||
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
|
||||
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/$repository-findbugs/findbugs-summary-$stableBranch.html | tr "\"" "\'" | tr -d "\r\n" | sed s"#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html\">FindBugs</a>#" | tr "\"" "\'" | tr -d "\n")
|
||||
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/spotbugs/spotbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html\">SpotBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
|
||||
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/$repository-findbugs/findbugs-summary-$stableBranch.html | tr "\"" "\'" | tr -d "\r\n" | sed s"#SpotBugs#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html\">SpotBugs</a>#" | tr "\"" "\'" | tr -d "\n")
|
||||
|
||||
|
||||
if ( [ $lintValue -eq 1 ] ) ; then
|
||||
|
@ -107,7 +107,7 @@ else
|
|||
fi
|
||||
|
||||
if ( [ $findbugsValue -eq 1 ] ) ; then
|
||||
findbugsMessage="<h1>Findbugs increased!</h1>"
|
||||
findbugsMessage="<h1>SpotBugs increased!</h1>"
|
||||
fi
|
||||
|
||||
# check gplay limitation: all changelog files must only have 500 chars
|
||||
|
|
|
@ -1 +1 @@
|
|||
472
|
||||
476
|
||||
|
|
|
@ -18,7 +18,7 @@ TRAVIS_GIT_USERNAME = String.new("Drone CI server")
|
|||
# lintOptions {
|
||||
# htmlOutput file("[FILE_NAME].html")
|
||||
# }
|
||||
FINDBUGS_REPORT_FILE = String.new("build/reports/findbugs/findbugs.html")
|
||||
FINDBUGS_REPORT_FILE = String.new("build/reports/spotbugs/spotbugs.html")
|
||||
|
||||
# File name and relative path of previous results of this script.
|
||||
PREVIOUS_FINDBUGS_RESULTS_FILE=String.new("scripts/analysis/findbugs-results.txt")
|
||||
|
@ -47,7 +47,7 @@ require 'xmlsimple'
|
|||
|
||||
# run FindBugs
|
||||
puts "running FindBugs..."
|
||||
system './gradlew findbugs'
|
||||
system './gradlew spotbugsGplayDebug'
|
||||
|
||||
# find FindBugs report file
|
||||
findbugs_reports = Dir.glob(FINDBUGS_REPORT_FILE)
|
||||
|
@ -58,7 +58,7 @@ end
|
|||
findbugs_report = String.new(findbugs_reports[0])
|
||||
|
||||
# find number of warnings
|
||||
current_warning_count = `grep -A 3 "<b>Total</b>" build/reports/findbugs/findbugs.html | tail -n1 | cut -f2 -d">" | cut -f1 -d"<"`.to_i
|
||||
current_warning_count = `grep -A 3 "<b>Total</b>" build/reports/spotbugs/spotbugs.html | tail -n1 | cut -f2 -d">" | cut -f1 -d"<"`.to_i
|
||||
puts "found warnings: " + current_warning_count.to_s
|
||||
|
||||
# get warning counts from last successful build
|
||||
|
|
Loading…
Reference in a new issue