Skip to content

Commit c384bb8

Browse files
committed
[ci] Fix shellcheck issues
1 parent 640b3fc commit c384bb8

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.ci/inc/regression-tester.inc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function regression_tester_setup_ci() {
1919

2020
gpg --batch --yes --decrypt --passphrase="GnxdjywUEPveyCD1RLiTd7t8CImnefYr" \
2121
--output .ci/files/public-env .ci/files/public-env.gpg
22+
# shellcheck disable=SC1091
2223
source .ci/files/public-env >/dev/null 2>&1
2324
rm .ci/files/public-env
2425

@@ -41,7 +42,7 @@ function regression_tester_setup_ci() {
4142
function regression_tester_uploadBaseline() {
4243
local pmdcodeUrl="https://pmd-code.org/pmd-regression-tester/"
4344
local baseline_branch="${PMD_CI_BRANCH:-$PMD_CI_TAG}"
44-
pmd_ci_log_debug "$FUNCNAME branch=${baseline_branch}"
45+
pmd_ci_log_debug "${FUNCNAME[0]} branch=${baseline_branch}"
4546

4647
pmd_ci_log_info "Generating and uploading baseline for pmdtester (${baseline_branch})..."
4748
pushd ..
@@ -50,34 +51,34 @@ function regression_tester_uploadBaseline() {
5051
bundle exec pmdtester \
5152
--mode single \
5253
--local-git-repo ./pmd \
53-
--patch-branch ${baseline_branch} \
54+
--patch-branch "${baseline_branch}" \
5455
--patch-config ./pmd/.ci/files/all-java.xml \
5556
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag \
5657
--error-recovery
57-
pushd target/reports
58+
pushd target/reports || { echo "Directory 'target/reports' doesn't exist"; exit 1; }
5859
BRANCH_FILENAME="${baseline_branch/\//_}"
59-
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
60+
zip -q -r "${BRANCH_FILENAME}-baseline.zip" "${BRANCH_FILENAME}/"
6061
# ssh-key for pmd-code.org is setup already by pmd_ci_setup_secrets_ssh
61-
scp ${BRANCH_FILENAME}-baseline.zip [email protected]:/httpdocs/pmd-regression-tester/
62+
scp "${BRANCH_FILENAME}-baseline.zip" [email protected]:/httpdocs/pmd-regression-tester/
6263
pmd_ci_log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${pmdcodeUrl}"
63-
popd
64-
popd
64+
popd || exit 1
65+
popd || exit 1
6566
}
6667

6768
#
6869
# Execute danger, which executes pmd-regression-tester (via Dangerfile).
6970
#
7071
function regression_tester_executeDanger() {
71-
pmd_ci_log_debug "$FUNCNAME"
72+
pmd_ci_log_debug "${FUNCNAME[0]}"
7273

7374
# Create a corresponding remote branch locally
74-
if ! git show-ref --verify --quiet refs/heads/${PMD_CI_BRANCH}; then
75-
git fetch --no-tags --depth=1 origin +refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH}
76-
git branch ${PMD_CI_BRANCH} origin/${PMD_CI_BRANCH}
75+
if ! git show-ref --verify --quiet "refs/heads/${PMD_CI_BRANCH}"; then
76+
git fetch --no-tags --depth=1 origin "+refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH}"
77+
git branch "${PMD_CI_BRANCH}" "origin/${PMD_CI_BRANCH}"
7778
pmd_ci_log_debug "Created local branch ${PMD_CI_BRANCH}"
7879
fi
7980
# Fetch more commits of the PR for danger and regression tester
80-
git fetch --no-tags --depth=50 origin +$(git rev-parse HEAD^2):
81+
git fetch --no-tags --depth=50 origin "+$(git rev-parse HEAD^2):"
8182
# Fetch more commits from master branch for regression tester
8283
if [[ "${PMD_CI_BRANCH}" != "master" ]]; then
8384
git fetch --no-tags --depth=50 origin +master:

0 commit comments

Comments
 (0)