eclipse-che/che-plugin-registry

Fix shellcheck error

apupier opened this issue · 0 comments

it is causing all PRs to be marked as red which makes it hard to know if the PR is correct or not.

#!/bin/sh -eo pipefail
find . -type f -name '*.sh' | wc -l
find . -type f -name '*.sh' | xargs shellcheck --external-sources
12

In ./check_plugins_location_v2.sh line 19:
declare -a arr=(`find "$1" -name "meta.yaml"`)
                ^---------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_location_v2.sh line 22:
    plugin_id=$(evaluate_plugin_id $i)
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_location_v1.sh line 15:
declare -a arr=(`find plugins -name "meta.yaml"`)
                ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./set_plugin_dates.sh line 17:
  if [ $? -ne 0 ]; then
       ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In ./set_plugin_dates.sh line 27:
declare -a arr=(`find . -name "meta.yaml"`)
                ^------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_viewer_mandatory_fields_v3.sh line 47:
declare -a arr=(`find v3 -name "meta.yaml"`)
                ^-------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^-------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_viewer_mandatory_fields_v3.sh line 50:
    plugin_id=$(evaluate_plugin_id $i)
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_viewer_mandatory_fields_v3.sh line 58:
      VALUE=$(yq r $i "$FIELD")
                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_viewer_mandatory_fields_v1.sh line 45:
declare -a arr=(`find plugins -name "meta.yaml"`)
                ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_viewer_mandatory_fields_v1.sh line 58:
      VALUE=$(yq r $i "$FIELD")
                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 53:
  docker tag ${IMAGE} $TARGET
             ^------^ SC2086: Double quote to prevent globbing and word splitting.
                      ^-----^ SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 54:
  docker push $TARGET
              ^-----^ SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 61:
  if [ $TARGET == "rhel" ]; then
       ^-----^ SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 69:
  if [ -n "${QUAY_USERNAME}" -a -n "${QUAY_PASSWORD}" ]; then
                             ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.


In ./cico_build.sh line 70:
    docker login -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} ${REGISTRY}
                    ^--------------^ SC2086: Double quote to prevent globbing and word splitting.
                                        ^--------------^ SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 78:
  TAG=$(echo $GIT_COMMIT | cut -c1-${DEVSHIFT_TAG_LEN})
             ^---------^ SC2086: Double quote to prevent globbing and word splitting.
                                   ^-----------------^ SC2086: Double quote to prevent globbing and word splitting.


In ./cico_build.sh line 80:
  tag_push ${REGISTRY}/openshiftio/$IMAGE:$TAG
                                          ^--^ SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_images.sh line 16:
declare -a arr=(`find . -name "meta.yaml"`)
                ^------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_images.sh line 19:
    ICON=$(yq r $i icon | sed 's/^"\(.*\)"$/\1/')
                ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_images.sh line 22:
      plugin_id=$(evaluate_plugin_id $i)
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_viewer_mandatory_fields_v2.sh line 45:
declare -a arr=(`find v2 -name "meta.yaml"`)
                ^-------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                ^-------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./check_plugins_viewer_mandatory_fields_v2.sh line 48:
    plugin_id=$(evaluate_plugin_id $i)
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./check_plugins_viewer_mandatory_fields_v2.sh line 56:
      VALUE=$(yq r $i "$FIELD")
                   ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./index.sh line 29:
    declare -a arr=(`find "$1" -name "meta.yaml"`)
                    ^---------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                    ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./index.sh line 42:
        plugin_id=$(getId $i)
                          ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./index.sh line 45:
        for field in ${fields[@]}
                     ^----------^ SC2068: Double quote array expansions to avoid re-splitting elements.


In ./index.sh line 47:
            echo "  \"$field\":\""$(yq r "$i" "$field" | sed 's/^"\(.*\)"$/\1/')"\","
                                  ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                  ^-- SC2046: Quote this to prevent word splitting.


In ./index.sh line 63:
        echo "  \"links\": {\"self\":\"/$(echo $i)\" }"
                                        ^--------^ SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./index_v2.sh line 23:
    evaluate_plugin_id $1
                       ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./index_v2.sh line 32:
    declare -a arr=(`find "$1" -name "meta.yaml"`)
                    ^---------------------------^ SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                    ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.


In ./index_v2.sh line 45:
        plugin_id=$(getId $i)
                          ^-- SC2086: Double quote to prevent globbing and word splitting.


In ./index_v2.sh line 48:
        for field in ${fields[@]}
                     ^----------^ SC2068: Double quote array expansions to avoid re-splitting elements.


In ./index_v2.sh line 50:
            echo "  \"$field\":\""$(yq r "$i" "$field" | sed 's/^"\(.*\)"$/\1/')"\","
                                  ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                  ^-- SC2046: Quote this to prevent word splitting.


In ./index_v2.sh line 66:
        echo "  \"links\": {\"self\":\"/$(echo $i|sed 's/\/meta.yaml$//g')\" }"
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.

For more information:
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
  https://www.shellcheck.net/wiki/SC2027 -- The surrounding quotes actually u...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
Exited with code 123