Skip to content

Commit

Permalink
Change spotless call
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <[email protected]>
  • Loading branch information
AndyScherzinger committed Nov 27, 2023
1 parent 8c785d7 commit 382553d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
10 changes: 5 additions & 5 deletions scripts/analysis/analysis-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ echo "Branch: $BRANCH"

if [ "$BRANCH" = $stableBranch ]; then
echo "New spotbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html"
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file app/build/reports/spotbugs/spotbugs.html
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.xml" --upload-file app/build/reports/spotbugs/gplayDebug.xml
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file core/build/reports/spotbugs/spotbugs.html
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.xml" --upload-file core/build/reports/spotbugs/debug.xml

if [ $lintValue -ne 1 ]; then
echo "New lint result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html"
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$stableBranch.html --upload-file app/build/reports/lint/lint.html
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$stableBranch.html --upload-file core/build/reports/lint/lint.html
exit 0
fi
else
if [ -e "${BUILD_NUMBER}" ]; then
6=$stableBranch"-"$(date +%F)
fi
echo "New lint results at https://www.kaminsky.me/nc-dev/$repository-lint/${BUILD_NUMBER}.html"
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/${BUILD_NUMBER}.html" --upload-file app/build/reports/lint/lint.html
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/${BUILD_NUMBER}.html" --upload-file core/build/reports/lint/lint.html

echo "New spotbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/${BUILD_NUMBER}.html"
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/${BUILD_NUMBER}.html" --upload-file app/build/reports/spotbugs/spotbugs.html
curl 2>/dev/null -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/${BUILD_NUMBER}.html" --upload-file core/build/reports/spotbugs/spotbugs.html

# delete all old comments, starting with Codacy
oldComments=$(curl_gh -X GET "https://api.github.com/repos/nextcloud/$repository/issues/${PR_NUMBER}/comments" | jq '.[] | select((.user.login | contains("github-actions")) and (.body | test("<h1>Codacy.*"))) | .id')
Expand Down
4 changes: 2 additions & 2 deletions scripts/analysis/spotbugs-up.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
require 'open3'

# run Spotbugs
puts "running Spotbugs..."
system './gradlew spotbugsGplayDebug 1>/dev/null 2>&1'
puts "running Spotless..."
system './gradlew spotlessCheck 1>/dev/null 2>&1'

# find number of warnings
current_warning_count = `./scripts/analysis/spotbugsSummary.py --total`.to_i
Expand Down
2 changes: 1 addition & 1 deletion scripts/analysis/spotbugsSummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def print_total(summary):
parser = argparse.ArgumentParser()
parser.add_argument("--total", help="print total count instead of summary HTML",
action="store_true")
parser.add_argument("--file", help="file to parse", default="app/build/reports/spotbugs/gplayDebug.xml")
parser.add_argument("--file", help="file to parse", default="core/build/reports/spotbugs/debug.xml")
args = parser.parse_args()
tree = ET.parse(args.file)
summary = get_counts(tree)
Expand Down
48 changes: 48 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
# Nextcloud Android Library is available under MIT license
#
# @author Álvaro Brey Vilas
# Copyright (C) 2022 Álvaro Brey Vilas
# Copyright (C) 2022 Nextcloud GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

## This file is intended to be sourced by other scripts


function err() {
echo >&2 "$@"
}


function curl_gh() {
if [[ -n "$GITHUB_TOKEN" ]]
then
curl \
--silent \
--header "Authorization: token $GITHUB_TOKEN" \
"$@"
else
err "WARNING: No GITHUB_TOKEN found. Skipping API call"
fi

}

0 comments on commit 382553d

Please sign in to comment.