Skip to content

[CI] Enable Shell checks #1162

Closed
Closed
@shahmishal

Description

@shahmishal
Run apt-get -qq update && apt-get -qq -y install shellcheck
  apt-get -qq update && apt-get -qq -y install shellcheck
  git ls-files -z '*.sh' | xargs -0 --no-run-if-empty shellcheck
  shell: sh -e {0}
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package shellcheck.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 16782 files and directories currently installed.)
Preparing to unpack .../shellcheck_0.9.0-1_amd64.deb ...
Unpacking shellcheck (0.9.0-1) ...
Setting up shellcheck (0.9.0-1) ...

In assets/test/sleep.sh line 1:
sleep $1
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
      ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
sleep "$1"


In assets/test/sleep.sh line 2:
exit $2
     ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
exit "$2"


In docker/test-ci.sh line 1:
#!/usr/bin/env node
^-- SC1008 (error): This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.


In docker/test-ci.sh line 3:
const { execSync } = require('child_process');
      ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
                 ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.
                            ^-- SC1036 (error): '(' is invalid here. Did you forget to escape it?
                            ^-- SC1088 (error): Parsing stopped here. Invalid use of parentheses?


In docker/test.sh line 1:
set -ex
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In docker/test.sh line 21:
(xvfb-run -a npm run coverage; echo $? > exitcode) | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" && rm -rf "${current_directory}/coverage" && (cp -R ./coverage $current_directory || true)
                                                                                                                                                                                        ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
(xvfb-run -a npm run coverage; echo $? > exitcode) | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" && rm -rf "${current_directory}/coverage" && (cp -R ./coverage "$current_directory" || true)


In docker/test.sh line 22:
exit $(<exitcode)
     ^----------^ SC2046 (warning): Quote this to prevent word splitting.


In scripts/soundness.sh line 92:
  expected_lines=$(cat "$tmp" | wc -l)
                       ^----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.


In scripts/soundness.sh line 93:
  expected_sha=$(cat "$tmp" | shasum)
                     ^----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.


In scripts/soundness.sh line 115:
    } | while read line; do
              ^--^ SC2162 (info): read without -r will mangle backslashes.


In scripts/soundness.sh line 116:
      if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
                   ^-----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
                                                                ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
      if [[ "$(cat "$line" | replace_acceptable_years | head -n "$expected_lines" | shasum)" != "$expected_sha" ]]; then


In scripts/soundness.sh line 117:
        printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
               ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".


In scripts/soundness.sh line 118:
        diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
                      ^-----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
                                                                   ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
        diff -u <(cat "$line" | replace_acceptable_years | head -n "$expected_lines") "$tmp"


In scripts/tag_release.sh line 20:
    exit -1
         ^-- SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr.

For more information:
  https://www.shellcheck.net/wiki/SC1008 -- This shebang was unrecognized. Sh...
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2242 -- Can only exit with status 0-255. ...
Error: Process completed with exit code 123.


Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions