Skip to content

Commit

Permalink
Issue #11637: Resolve shellcheck SC2046
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyanK7 authored and romani committed Aug 10, 2022
1 parent 51191d3 commit b7899db
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .ci/common.sh
Expand Up @@ -94,8 +94,8 @@ function should_run_job {
fi

# Note: this command only works in master branch
if [ $(git log -1 --format=%B | grep -E "\[maven-release-plugin\] prepare release" \
| cat | wc -l) -lt 1 ];
if [ "$(git log -1 --format=%B | grep -E "\[maven-release-plugin\] prepare release" \
| cat | wc -l)" -lt 1 ];
then
SKIP_JOB_BY_COMMIT="false"
else
Expand Down
2 changes: 1 addition & 1 deletion .ci/eclipse-compiler-javac.sh
Expand Up @@ -36,7 +36,7 @@ if [ ! -f "$ECJ_PATH" ]; then
echo please update "config/org.eclipse.jdt.core.prefs" file
exit 1
fi
mkdir -p $(dirname "$ECJ_PATH")
mkdir -p "$(dirname "$ECJ_PATH")"
cp "$ECJ_JAR" "$ECJ_PATH"
cd ..
fi
Expand Down
2 changes: 1 addition & 1 deletion .ci/releasenotes-gen.sh
Expand Up @@ -42,7 +42,7 @@ else
cd ../
fi
cd .ci-temp/checkstyle
LATEST_RELEASE_TAG=$(git describe $(git rev-list --tags --max-count=1))
LATEST_RELEASE_TAG=$(git describe "$(git rev-list --tags --max-count=1)")
cd ../../

CS_RELEASE_VERSION=$(mvn -e --no-transfer-progress -q -Dexec.executable='echo' \
Expand Down
2 changes: 1 addition & 1 deletion .ci/travis.sh
Expand Up @@ -88,7 +88,7 @@ run-command-after-success)

deploy-snapshot)
SKIP_DEPLOY=false
if [ $(git log -1 | grep -E "\[maven-release-plugin\] prepare release" | cat | wc -l) -lt 1 ];
if [ "$(git log -1 | grep -E "\[maven-release-plugin\] prepare release" | cat | wc -l)" -lt 1 ];
then
SKIP_DEPLOY=false;
else
Expand Down
9 changes: 5 additions & 4 deletions .ci/validation.sh
Expand Up @@ -88,7 +88,7 @@ nondex)
mvn -e --no-transfer-progress --fail-never clean nondex:nondex -DargLine='-Xms1024m -Xmx2048m' \
-Dtest=!JavadocPropertiesGeneratorTest#testNonExistentArgument
mkdir -p .ci-temp
cat $(grep -RlE 'td class=.x' .nondex/ | cat) < /dev/null > .ci-temp/output.txt
cat "$(grep -RlE 'td class=.x' .nondex/ | cat)" < /dev/null > .ci-temp/output.txt
RESULT=$(cat .ci-temp/output.txt | wc -c)
cat .ci-temp/output.txt
echo 'Size of output:'"$RESULT"
Expand All @@ -102,7 +102,7 @@ pr-age)
# if it notices a merge commit
if git show --summary HEAD | grep ^Merge: ;
then
git reset --hard $(git log -n 1 --no-merges --pretty=format:"%h")
git reset --hard "$(git log -n 1 --no-merges --pretty=format:"%h")"
fi

PR_MASTER=$(git merge-base origin/master HEAD)
Expand Down Expand Up @@ -169,7 +169,7 @@ versions)
if [ -v TRAVIS_EVENT_TYPE ] && [ "$TRAVIS_EVENT_TYPE" != "cron" ] ; then exit 0; fi
mvn -e --no-transfer-progress clean versions:dependency-updates-report \
versions:plugin-updates-report
if [ $(grep "<nextVersion>" target/*-updates-report.xml | cat | wc -l) -gt 0 ]; then
if [ "$(grep "<nextVersion>" target/*-updates-report.xml | cat | wc -l)" -gt 0 ]; then
echo "Version reports (dependency-updates-report.xml):"
cat target/dependency-updates-report.xml
echo "Version reports (plugin-updates-report.xml):"
Expand Down Expand Up @@ -403,7 +403,8 @@ site)
;;

release-dry-run)
if [ $(git log -1 | grep -E "\[maven-release-plugin\] prepare release" | cat | wc -l) -lt 1 ];then
if [ "$(git log -1 | grep -E "\[maven-release-plugin\] prepare release" | cat | wc -l)" -lt 1 ]
then
mvn -e --no-transfer-progress release:prepare -DdryRun=true --batch-mode \
-Darguments='-DskipTests -DskipITs -Djacoco.skip=true -Dpmd.skip=true \
-Dspotbugs.skip=true -Dxml.skip=true -Dcheckstyle.ant.skip=true \
Expand Down
1 change: 0 additions & 1 deletion .shellcheckrc
@@ -1,6 +1,5 @@
# until https://github.com/checkstyle/checkstyle/issues/11637

disable=SC2046 # (warning): Quote this to prevent word splitting.
disable=SC2207 # (warning): Prefer mapfile or read -a to split command output.
disable=SC2002 # (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
disable=SC2061 # (warning): Quote the parameter to -name so the shell won't interpret it.
Expand Down
7 changes: 4 additions & 3 deletions release.sh
Expand Up @@ -6,7 +6,8 @@ echo "Release process: https://github.com/checkstyle/checkstyle/wiki/How-to-make

RELEASE=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \
-t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//")
PREV_RELEASE=$(git describe --abbrev=0 $(git rev-list --tags --max-count=1) | sed "s/checkstyle-//")
PREV_RELEASE=$(git describe --abbrev=0 "$(git rev-list --tags --max-count=1)" \
| sed "s/checkstyle-//")

echo "PREVIOUS RELEASE version:""$PREV_RELEASE"
echo "RELEASE version:""$RELEASE"
Expand Down Expand Up @@ -56,7 +57,7 @@ cd ../../

NEW_RELEASE=$(git describe --abbrev=0 | cut -d '-' -f 2)
PREV_RELEASE=$(git describe --abbrev=0 --tags \
$(git rev-list --tags --skip=1 --max-count=1) \
"$(git rev-list --tags --skip=1 --max-count=1)" \
| cut -d '-' -f 2)
FUTURE_RELEASE=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \
-t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//")
Expand Down Expand Up @@ -90,7 +91,7 @@ curl -i -H "Authorization: token $TKN" \


echo "Creation of new milestone ..."
LAST_SUNDAY_DAY=$(cal -d $(date -d "next month" +"%Y-%m") \
LAST_SUNDAY_DAY=$(cal -d "$(date -d "next month" +"%Y-%m")" \
| awk '/^ *[0-9]/ { d=$1 } END { print d }')
LAST_SUNDAY_DATETIME=$(date -d "next month" +"%Y-%m")"-$LAST_SUNDAY_DAY""T08:00:00Z"
echo "$LAST_SUNDAY_DATETIME"
Expand Down

0 comments on commit b7899db

Please sign in to comment.