Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #11637: Used Shellcheck to resolve SC2236 in Shell Script #11664

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/checkchmod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CHMOD=$(find -type f -not -path '*/\.git/*' \
-a -type f -not -name '*.sh' \
-a -type f -not -name '*.pl' \
-a \( -type d -not -perm 775 -o -type f -executable \))
if [[ ! -z $CHMOD ]]; then
if [[ -n $CHMOD ]]; then
echo "Expected mode for non '.sh' files is 664.";
echo "Files that violates this rule:"
for NAMEFILE in $CHMOD
Expand All @@ -20,7 +20,7 @@ fi

# On Travis, after clone, all 'sh' files have executable bit
CHMOD=$(find -type f -not -path '*/\.git/*' -a -type f -name '*.sh' -a -not -executable)
if [[ ! -z $CHMOD ]]; then
if [[ -n $CHMOD ]]; then
echo "Expected mode for '.sh' files is 755.";
echo "Files that violates this rule:"
for NAMEFILE in $CHMOD
Expand Down
4 changes: 2 additions & 2 deletions .ci/no_old_refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MAIN_REPO="checkstyle/checkstyle"
DEFAULT_BRANCH="master"

# These are modified when event is of type pull_request
if [ ! -z "$PR_HEAD_REPO_NAME" ]; then
if [ -n "$PR_HEAD_REPO_NAME" ]; then
MAIN_REPO=$PR_HEAD_REPO_NAME
DEFAULT_BRANCH=$GITHUB_HEAD_REF
fi
Expand Down Expand Up @@ -43,7 +43,7 @@ for MENTIONED_ISSUES_GREP_OUTPUT_LINE in $(cat $MENTIONED_ISSUES_GREP_OUTPUT); d
if [ "$STATE" = "closed" ]; then
echo "$LINK" >> $CLOSED_ISSUES
fi
if [ ! -z "$LINKED_ISSUES" ]; then
if [ -n "$LINKED_ISSUES" ]; then
for LINKED_ISSUE in $(cat "$LINKED_ISSUES"); do
if [ "$LINKED_ISSUE" = "$GITHUB_HOST/$ISSUE" ]; then
echo "$LINK" >> $LINKED_ISSUES_MENTIONED
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no_old_refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
LINKED_ISSUES=${{ steps.links.outputs.issues }}
LINKED_ISSUES_FORMATTED=/tmp/linked_issues
CHECKSTYLE_ISSUE_URL="https:\/\/github.com\/checkstyle\/checkstyle\/issues\/"
if [ ! -z "$LINKED_ISSUES" ]; then
if [ -n "$LINKED_ISSUES" ]; then
echo $LINKED_ISSUES | sed -e 's/,/\n/g' >> $LINKED_ISSUES_FORMATTED
sed -i "s/^/$CHECKSTYLE_ISSUE_URL/" $LINKED_ISSUES_FORMATTED
fi
Expand Down
1 change: 0 additions & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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.
disable=SC2035 # (info): Use ./glob or -- glob so names with dashes won't become options.
disable=SC2236 # (style): Use -n instead of ! -z.
disable=SC2016 # (info): Expressions don't expand in single quotes, use double quotes for that.
disable=SC2185 # (info): Some finds don't have a default path. Specify '.' explicitly.
disable=SC2155 # (warning): Declare and assign separately to avoid masking return values.
Expand Down