diff --git a/build.gradle b/build.gradle index 88064e4cda..31f1bc26c2 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh index 2fc83d7757..e3a9dfa602 100755 --- a/scripts/analysis/analysis-wrapper.sh +++ b/scripts/analysis/analysis-wrapper.sh @@ -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 "/

Summary<\/h1>/,/

Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'///'g | sed s"/Summary/FindBugs ($stableBranch)/" | tr "\"" "\'" | tr -d "\r\n") + summary=$(sed -n "/

Summary<\/h1>/,/

Warnings<\/h1>/p" build/reports/spotbugs/spotbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'///'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="

Lint

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

Summary<\/h1>/,/

Warnings<\/h1>/p" 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/$repository-findbugs/findbugs-summary-$stableBranch.html | tr "\"" "\'" | tr -d "\r\n" | sed s"#FindBugs#FindBugs#" | tr "\"" "\'" | tr -d "\n") + findbugsResultNew=$(sed -n "/

Summary<\/h1>/,/

Warnings<\/h1>/p" build/reports/spotbugs/spotbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'///'g | sed s"#Summary#SpotBugs (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#SpotBugs#" | tr "\"" "\'" | tr -d "\n") if ( [ $lintValue -eq 1 ] ) ; then @@ -107,7 +107,7 @@ else fi if ( [ $findbugsValue -eq 1 ] ) ; then - findbugsMessage="

Findbugs increased!

" + findbugsMessage="

SpotBugs increased!

" fi # check gplay limitation: all changelog files must only have 500 chars diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index 2d3d9c27b6..b863957334 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -472 \ No newline at end of file +476 diff --git a/scripts/analysis/findbugs-up.rb b/scripts/analysis/findbugs-up.rb index f995ada2e7..61b4fe1428 100644 --- a/scripts/analysis/findbugs-up.rb +++ b/scripts/analysis/findbugs-up.rb @@ -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 "Total" build/reports/findbugs/findbugs.html | tail -n1 | cut -f2 -d">" | cut -f1 -d"<"`.to_i +current_warning_count = `grep -A 3 "Total" 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