Skip to content

Use shellcheck for linting code #1

@Potherca

Description

@Potherca

You might want to strat using Shellcheck to lint shell code for possible issues.

The current run gives us:

[Line 4:](javascript:setPosition(4, 1))
[[ -z "$INGEST_KEY" ]] && echo "INGEST_KEY not set" && exit 1
^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 25:](javascript:setPosition(25, 14))
  data=$(cat go.list | base64)
             ^-- [SC2002](https://github.com/koalaman/shellcheck/wiki/SC2002) (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 
[Line 39:](javascript:setPosition(39, 14))
  data=$(cat pom.xml | base64)
             ^-- [SC2002](https://github.com/koalaman/shellcheck/wiki/SC2002) (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 
[Line 52:](javascript:setPosition(52, 17))
  content=$(cat package.json | base64)
                ^-- [SC2002](https://github.com/koalaman/shellcheck/wiki/SC2002) (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 
[Line 54:](javascript:setPosition(54, 6))
  if [[ -e "package-lock.json" ]]; then
     ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 55:](javascript:setPosition(55, 19))
    content=$(cat package-lock.json | base64)
                  ^-- [SC2002](https://github.com/koalaman/shellcheck/wiki/SC2002) (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 
[Line 57:](javascript:setPosition(57, 8))
  elif [[ -e "yarn.lock" ]]; then
       ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 58:](javascript:setPosition(58, 19))
    content=$(cat yarn.lock | base64)
                  ^-- [SC2002](https://github.com/koalaman/shellcheck/wiki/SC2002) (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 
[Line 91:](javascript:setPosition(91, 9))
  while [[ $# -gt 0 ]]; do
        ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 106:](javascript:setPosition(106, 12))
        if [[ ! -z "$OWN_MODULES" ]]; then
           ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
              ^-- [SC2236](https://github.com/koalaman/shellcheck/wiki/SC2236) (style): Use -n instead of ! -z.
 
[Line 113:](javascript:setPosition(113, 12))
        if [[ ! -z "$OWN_SCOPES" ]]; then
           ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
              ^-- [SC2236](https://github.com/koalaman/shellcheck/wiki/SC2236) (style): Use -n instead of ! -z.
 
[Line 131:](javascript:setPosition(131, 3))
  [[ -z "$ENTITY" ]] && print_help && exit 1
  ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 132:](javascript:setPosition(132, 3))
  [[ -z "$REPO" ]] && print_help && exit 1
  ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 134:](javascript:setPosition(134, 6))
  if [[ "$TYPE" = "go.list" ]] && [[ -e "go.list" ]]; then
     ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
                                  ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 138:](javascript:setPosition(138, 6))
  if [[ "$TYPE" = "pom.xml" ]] && [[ -e "pom.xml" ]]; then
     ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
                                  ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
 
[Line 142:](javascript:setPosition(142, 6))
  if [[ "$TYPE" = "package.json" ]] && [[ -e "package.json" ]]; then
     ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.
                                       ^-- [SC3010](https://github.com/koalaman/shellcheck/wiki/SC3010) (warning): In POSIX sh, [[ ]] is undefined.

When time allows, I could open an MR with fixes and a GitHub Workflow to check any future changes against Shellcheck?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions