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

Use shellcheck for linting code #1

Open
Potherca opened this issue Mar 21, 2022 · 0 comments
Open

Use shellcheck for linting code #1

Potherca opened this issue Mar 21, 2022 · 0 comments

Comments

@Potherca
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant