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

[CI] Enable Shell check #430

Open
shahmishal opened this issue Oct 25, 2024 · 0 comments
Open

[CI] Enable Shell check #430

shahmishal opened this issue Oct 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@shahmishal
Copy link
Member

https://github.com/apple/swift-collections/actions/runs/11512888219/job/32048639835?pr=426

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 Utils/generate-docs.sh line 15:
shopt -s nullglob
^---------------^ SC3044 (warning): In POSIX sh, 'shopt' is undefined.


In Utils/generate-docs.sh line 16:
cd "$(dirname $0)/.."
              ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
cd "$(dirname "$0")/.."


In Utils/generate-docs.sh line 20:
    export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render"
           ^-----------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                                    ^------------------^ SC2046 (warning): Quote this to prevent word splitting.


In Utils/generate-docs.sh line 25:
build_dir="$(mktemp -d "/tmp/$(basename $0).XXXXX")"
                                        ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
build_dir="$(mktemp -d "/tmp/$(basename "$0").XXXXX")"


In Utils/generate-docs.sh line 39:
    targets="$@"
            ^--^ SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.


In Utils/generate-docs.sh line 48:
                output="Sources/Collections/Collections.docc/Extensions/$(basename $file)"
                                                                                   ^---^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                output="Sources/Collections/Collections.docc/Extensions/$(basename "$file")"


In Utils/generate-docs.sh line 50:
                sed 's?^# ``[^/]*/\(.*\)``?# ``Collections/\1``\n\n'"$blurb"'\n?' "$file" > "$output"
                    ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.


In Utils/generate-sources.sh line 33:
trap "rm -rf \"$tmpdir\"" EXIT
               ^-----^ SC2064 (warning): Use single quotes, otherwise this expands now rather than when signalled.


In Utils/generate-sources.sh line 37:
find ./Sources ./Tests -name "*.gyb" | while read input; do
                                             ^--^ SC2162 (info): read without -r will mangle backslashes.


In Utils/generate-sources.sh line 59:
sort "$tmpdir/generated-files.txt" | uniq -u | while read obsolete; do
                                                     ^--^ SC2162 (info): read without -r will mangle backslashes.


In Utils/run-benchmarks.sh line 12:
  local flags
  ^---------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In Utils/run-benchmarks.sh line 15:
  swift run --package-path "$srcroot" $flags benchmark "$@"
                                      ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
  swift run --package-path "$srcroot" "$flags" benchmark "$@"


In Utils/run-benchmarks.sh line 35:
        rm -rf "$out"/results
                ^--^ SC2154 (warning): out is referenced but not assigned.


In Utils/run-full-tests.sh line 22:
cd "$(dirname $0)/.."
              ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
cd "$(dirname "$0")/.."


In Utils/run-full-tests.sh line 24:
build_dir="$(mktemp -d "/tmp/$(basename $0).XXXXX")"
                                        ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
build_dir="$(mktemp -d "/tmp/$(basename "$0").XXXXX")"


In Utils/run-full-tests.sh line 52:
    _count=$(($_count + 1))
              ^-----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.


In Utils/run-full-tests.sh line 55:
    echo "$bold_on[$count $label]$bold_off $@"
          ^-- SC1087 (error): Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
                                           ^-- SC2145 (error): Argument mixes string and array. Use * or separate argument.


In Utils/run-full-tests.sh line 59:
        echo "  Completed in $(($end - $start))s"
                                ^--^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
                                       ^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.


In Utils/run-full-tests.sh line 62:
        echo "  ${red_on}${bold_on}Failed in $(($end - $start))s.${bold_off}${red_off}" \
                                                ^--^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
                                                       ^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.


In Utils/run-full-tests.sh line 69:
try "spm.debug" $swift test -c debug $spm_flags --build-path "$build_dir/spm.debug"
                ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                     ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.debug" "$swift" test -c debug "$spm_flags" --build-path "$build_dir/spm.debug"


In Utils/run-full-tests.sh line 70:
try "spm.release" $swift test -c release $spm_flags --build-path "$build_dir/spm.release"
                  ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.release" "$swift" test -c release "$spm_flags" --build-path "$build_dir/spm.release"


In Utils/run-full-tests.sh line 111:
try "benchmarks.debug" $swift run -c debug $spm_flags --build-path "$build_dir/benchmarks.debug" benchmark --help
                       ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                           ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "benchmarks.debug" "$swift" run -c debug "$spm_flags" --build-path "$build_dir/benchmarks.debug" benchmark --help


In Utils/run-full-tests.sh line 112:
try "benchmarks.release" $swift run -c release $spm_flags --build-path "$build_dir/benchmarks.release" benchmark --help
                         ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                               ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "benchmarks.release" "$swift" run -c release "$spm_flags" --build-path "$build_dir/benchmarks.release" benchmark --help


In Utils/run-full-tests.sh line 120:
try "spm.internal-checks" $swift test -c debug -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS $spm_flags --build-path "$build_dir/spm.internal-checks"
                          ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                      ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.internal-checks" "$swift" test -c debug -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS "$spm_flags" --build-path "$build_dir/spm.internal-checks"


In Utils/run-full-tests.sh line 121:
try "spm.deterministic-hashing" $swift test -c debug -Xswiftc -DCOLLECTIONS_DETERMINISTIC_HASHING $spm_flags --build-path "$build_dir/spm.deterministic-hashing"
                                ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                  ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.deterministic-hashing" "$swift" test -c debug -Xswiftc -DCOLLECTIONS_DETERMINISTIC_HASHING "$spm_flags" --build-path "$build_dir/spm.deterministic-hashing"


In Utils/run-full-tests.sh line 122:
try "spm.internal-checks+deterministic-hashing" $swift test -c debug -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS -Xswiftc -DCOLLECTIONS_DETERMINISTIC_HASHING $spm_flags --build-path "$build_dir/spm.internal-checks+deterministic-hashing"
                                                ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                                                                         ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.internal-checks+deterministic-hashing" "$swift" test -c debug -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS -Xswiftc -DCOLLECTIONS_DETERMINISTIC_HASHING "$spm_flags" --build-path "$build_dir/spm.internal-checks+deterministic-hashing"


In Utils/run-full-tests.sh line 126:
try "spm.warnings-as-errors.debug"  $swift build -c debug -Xswiftc -warnings-as-errors $spm_flags --build-path "$build_dir/spm.warnings-as-errors"
                                    ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                       ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.warnings-as-errors.debug"  "$swift" build -c debug -Xswiftc -warnings-as-errors "$spm_flags" --build-path "$build_dir/spm.warnings-as-errors"


In Utils/run-full-tests.sh line 127:
try "spm.warnings-as-errors.release"  $swift build -c release -Xswiftc -warnings-as-errors $spm_flags --build-path "$build_dir/spm.warnings-as-errors"
                                      ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                           ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
try "spm.warnings-as-errors.release"  "$swift" build -c release -Xswiftc -warnings-as-errors "$spm_flags" --build-path "$build_dir/spm.warnings-as-errors"


In Utils/run-full-tests.sh line 133:
        $swift build \
        ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
        "$swift" build \


In Utils/run-full-tests.sh line 135:
        $spm_flags \
        ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
        "$spm_flags" \


In Utils/shuffle-sources.sh line 14:
function shuffle() {
^-- SC2112 (warning): 'function' keyword is non-standard. Delete it.


In Utils/shuffle-sources.sh line 19:
    local i=0
    ^-----^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In Utils/shuffle-sources.sh line 20:
    ls "$input"/*.swift | sort -R | while read file; do
    ^-----------------^ SC2012 (info): Use find instead of ls to better handle non-alphanumeric filenames.
                                          ^--^ SC2162 (info): read without -r will mangle backslashes.


In Utils/shuffle-sources.sh line 22:
        i=$(($i + 1))
             ^-- SC2004 (style): $/${} is unnecessary on arithmetic variables.


In Utils/shuffle-sources.sh line 29:
if [[ -z "${1+set}" || ! -d "$1" ]]; then
   ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In Utils/shuffle-sources.sh line 47:
    i="$(($i + 1))"
          ^-- SC2004 (style): $/${} is unnecessary on arithmetic variables.

For more information:
  https://www.shellcheck.net/wiki/SC1087 -- Use braces when expanding arrays,...
  https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
Error: Process completed with exit code 123.
@shahmishal shahmishal added the bug Something isn't working label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant