Skip to content

Commit

Permalink
add link to shellcheck wiki for disable directives
Browse files Browse the repository at this point in the history
  • Loading branch information
richm committed May 15, 2020
1 parent 3c18f7f commit d999ca3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ linux-system-roles repos.

# shellcheck

When making edits, use `shellcheck *.sh` to check your scripts for
common shell script problems. On Fedora, `dnf -y install ShellCheck`.
When making edits, use `shellcheck *.sh` to check your scripts for common
shell script problems. On Fedora, `dnf -y install ShellCheck`. There is
currently no way to disable a check by using a mnemonic string or keyword
value - you must use a code like `SC2034`. See
https://github.com/koalaman/shellcheck/issues/1948 - In the meantime, if you
need to disable a check, add a link to the ShellCheck wiki like this:
```
# https://github.com/koalaman/shellcheck/wiki/SC2064
# shellcheck disable=SC2064
trap "rm -f ${STDOUT} ${STDERR}; cd ${HERE}" ABRT EXIT HUP INT QUIT
```
So that someone can easily figure out what this code means. NOTE that the
link must come first, followed by the comment with the shellcheck disable
directive.

# sync-template.sh

Expand Down
3 changes: 3 additions & 0 deletions list-pr-issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fi
# current usage - https://developer.github.com/v3/rate_limit/

# in jq format - see https://stedolan.github.io/jq/manual/
# https://github.com/koalaman/shellcheck/wiki/SC2016
# shellcheck disable=SC2016
PR_FORMAT=${PR_FORMAT:-'"\(.created_at|fromdateiso8601)" + " " + .user.login + " " + .created_at + " " + .html_url + " \(.title|gsub($eliputf; $elip))"'}
# see https://developer.github.com/v3/pulls/
Expand Down Expand Up @@ -80,6 +81,7 @@ LISTTYPE=${LISTTYPE:-both}
if [ "$LISTTYPE" = prs ] || [ "$LISTTYPE" = both ] ; then
echo PRS
header
# https://github.com/koalaman/shellcheck/wiki/SC2034
# shellcheck disable=SC2034
for repo in $REPOS ; do
list_prs "$LSR_ORG" "$repo"
Expand All @@ -96,6 +98,7 @@ fi
if [ "$LISTTYPE" = issues ] || [ "$LISTTYPE" = both ] ; then
echo ISSUES
header
# https://github.com/koalaman/shellcheck/wiki/SC2034
# shellcheck disable=SC2034
for repo in $REPOS ; do
list_issues "$LSR_ORG" "$repo"
Expand Down
4 changes: 4 additions & 0 deletions sync-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ declare -A IGNORE_IF_MISSING_MAP
INDENT=""
INHELP=""

# https://github.com/koalaman/shellcheck/wiki/SC2064
# shellcheck disable=SC2064
trap "rm -f ${STDOUT} ${STDERR}; cd ${HERE}" ABRT EXIT HUP INT QUIT

Expand Down Expand Up @@ -238,6 +239,7 @@ function copy_recursive() {
ensure_directory "$2" "$3"
local src
local dest
# https://github.com/koalaman/shellcheck/wiki/SC2044
# shellcheck disable=SC2044
for src in $(find "$1/$3"); do
dest=${src#$1/}
Expand Down Expand Up @@ -594,6 +596,7 @@ function check_required_options() {
# Put a link to the revision into the payload.
function put_revision() {
# looks like a false positive
# https://github.com/koalaman/shellcheck/wiki/SC2016
# shellcheck disable=SC2016
printf '\nRevision: [`%s`](%s)' "$1" "${GITHUB}/${LSR_TEMPLATE_NS}/tree/$1"
}
Expand Down Expand Up @@ -890,6 +893,7 @@ function do_sync() {
fi
runcmd "git commit -a -m 'Synchronize files from ${FROM_REPO}'"
if github_push "${SYNC_BRANCH}" "${REPO}"; then
# https://github.com/koalaman/shellcheck/wiki/SC2086
# shellcheck disable=SC2086
submit_pr "Synchronize files from ${LSR_TEMPLATE_NS}" master "${SYNC_BRANCH}" \
"This PR propagates files from [${LSR_TEMPLATE_NS}](${GITHUB}/${LSR_TEMPLATE_NS}) which should be in sync across [${LSR_GROUP}](${GITHUB}/${LSR_GROUP}) repos. In case of changing affected files via pushing to this PR, please do not forget also to push the changes to [${LSR_TEMPLATE_NS}](${GITHUB}/${LSR_TEMPLATE_NS}) repo.\n$(put_revision ${GIT_HEAD})\n$(expand_contacts)"
Expand Down

0 comments on commit d999ca3

Please sign in to comment.