loading
Generated 2023-04-10T04:47:17+00:00

All Files ( 90.79% covered at 1.07 hits/line )

30 files in total.
152 relevant lines, 138 lines covered and 14 lines missed. ( 90.79% )
File % covered Lines Relevant Lines Lines covered Lines missed Avg. Hits / Line
never_called.sh 0.00 % 4 1 0 1 0.00
scripts/array.sh 100.00 % 8 6 6 0 1.00
scripts/bad_syntax.sh 25.00 % 9 4 1 3 0.25
scripts/case.sh 83.33 % 16 6 5 1 1.00
scripts/cd.sh 100.00 % 21 11 11 0 2.18
scripts/comments.sh 100.00 % 13 4 4 0 1.00
scripts/delete.sh 100.00 % 9 6 6 0 1.00
scripts/executable 100.00 % 4 1 1 0 1.00
scripts/exit_non_zero.sh 100.00 % 3 1 1 0 1.00
scripts/function.sh 100.00 % 20 7 7 0 1.14
scripts/long_line.sh 75.00 % 7 4 3 1 0.75
scripts/multiline.sh 88.00 % 41 25 22 3 0.96
scripts/multiline2.sh 100.00 % 48 37 37 0 1.00
scripts/multiline3.sh 100.00 % 6 4 4 0 1.00
scripts/multiline4.sh 100.00 % 4 2 2 0 1.00
scripts/nested/simple.sh 75.00 % 13 4 3 1 0.75
scripts/new line.sh 100.00 % 5 2 2 0 1.50
scripts/no_extension/bin_bash 100.00 % 3 1 1 0 1.00
scripts/no_extension/bin_bash_with_args 100.00 % 3 1 1 0 1.00
scripts/no_extension/bin_dash 0.00 % 3 1 0 1 0.00
scripts/no_extension/usr_bin_env_bash 100.00 % 3 1 1 0 1.00
scripts/no_shebang.sh 100.00 % 5 1 1 0 1.00
scripts/nounset.sh 66.67 % 7 3 2 1 0.67
scripts/one_liner.sh 66.67 % 9 3 2 1 1.00
scripts/process_substitution.sh 100.00 % 9 3 3 0 2.33
scripts/simple.sh 75.00 % 13 4 3 1 0.75
scripts/source.sh 100.00 % 6 2 2 0 1.50
scripts/sourced.txt 100.00 % 4 1 1 0 1.00
scripts/unicode.sh 100.00 % 6 2 2 0 1.00
test_suite.sh 100.00 % 8 4 4 0 1.25

Bash Scripts ( 91.1% covered at 1.08 hits/line )

24 files in total.
146 relevant lines, 133 lines covered and 13 lines missed. ( 91.1% )
File % covered Lines Relevant Lines Lines covered Lines missed Avg. Hits / Line
never_called.sh 0.00 % 4 1 0 1 0.00
scripts/array.sh 100.00 % 8 6 6 0 1.00
scripts/bad_syntax.sh 25.00 % 9 4 1 3 0.25
scripts/case.sh 83.33 % 16 6 5 1 1.00
scripts/cd.sh 100.00 % 21 11 11 0 2.18
scripts/comments.sh 100.00 % 13 4 4 0 1.00
scripts/delete.sh 100.00 % 9 6 6 0 1.00
scripts/exit_non_zero.sh 100.00 % 3 1 1 0 1.00
scripts/function.sh 100.00 % 20 7 7 0 1.14
scripts/long_line.sh 75.00 % 7 4 3 1 0.75
scripts/multiline.sh 88.00 % 41 25 22 3 0.96
scripts/multiline2.sh 100.00 % 48 37 37 0 1.00
scripts/multiline3.sh 100.00 % 6 4 4 0 1.00
scripts/multiline4.sh 100.00 % 4 2 2 0 1.00
scripts/nested/simple.sh 75.00 % 13 4 3 1 0.75
scripts/new line.sh 100.00 % 5 2 2 0 1.50
scripts/no_shebang.sh 100.00 % 5 1 1 0 1.00
scripts/nounset.sh 66.67 % 7 3 2 1 0.67
scripts/one_liner.sh 66.67 % 9 3 2 1 1.00
scripts/process_substitution.sh 100.00 % 9 3 3 0 2.33
scripts/simple.sh 75.00 % 13 4 3 1 0.75
scripts/source.sh 100.00 % 6 2 2 0 1.50
scripts/unicode.sh 100.00 % 6 2 2 0 1.00
test_suite.sh 100.00 % 8 4 4 0 1.25

Nested scripts ( 75.0% covered at 0.75 hits/line )

1 files in total.
4 relevant lines, 3 lines covered and 1 lines missed. ( 75.0% )
File % covered Lines Relevant Lines Lines covered Lines missed Avg. Hits / Line
scripts/nested/simple.sh 75.00 % 13 4 3 1 0.75

Ungrouped ( 83.33% covered at 0.83 hits/line )

6 files in total.
6 relevant lines, 5 lines covered and 1 lines missed. ( 83.33% )
File % covered Lines Relevant Lines Lines covered Lines missed Avg. Hits / Line
scripts/executable 100.00 % 4 1 1 0 1.00
scripts/no_extension/bin_bash 100.00 % 3 1 1 0 1.00
scripts/no_extension/bin_bash_with_args 100.00 % 3 1 1 0 1.00
scripts/no_extension/bin_dash 0.00 % 3 1 0 1 0.00
scripts/no_extension/usr_bin_env_bash 100.00 % 3 1 1 0 1.00
scripts/sourced.txt 100.00 % 4 1 1 0 1.00

never_called.sh

0.0% lines covered

1 relevant lines. 0 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. echo "I'm never executed by any script"

scripts/array.sh

100.0% lines covered

6 relevant lines. 6 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 arr=(
  3. 1 foo
  4. 1 bar
  5. 1 baz
  6. 1 quux
  7. 1 )

scripts/bad_syntax.sh

25.0% lines covered

4 relevant lines. 1 lines covered and 3 lines missed.
    
  1. # Tests that Bashcov::Detective excludes shell scripts with
  2. # 1. A shellscript extension like .sh or .bash *and*
  3. # 2. Contents that *do not* follow valid shell syntax
  4. 1 confused = true
  5. if confused
  6. puts 'I though this was supposed to be a shell script?'
  7. end

scripts/case.sh

83.33% lines covered

6 relevant lines. 5 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. function switch() {
  3. 2 case $1 in
  4. -h|--help)
  5. 1 echo help
  6. ;;
  7. -v|--version)
  8. echo version;;
  9. 1 *) echo "what?";;
  10. esac
  11. }
  12. 1 switch -h
  13. 1 switch bug

scripts/cd.sh

100.0% lines covered

11 relevant lines. 11 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 : "${this:=that}"
  3. 2 : "${that:=thing}" && touch /dev/fd/1
  4. 3 dir="$(cd "${BASH_SOURCE%/*}" || : ; pwd -P)"
  5. 1 todir=''
  6. 3 printf -v todir -- '%s' "$(find "$dir" -type d | head -n 1)"
  7. 2 (cd ../.. || : ; cd "$HOME" || : )
  8. 1 cd ../.. || :
  9. 3 it () { : ; }
  10. 6 { for _ in {1..3}; do it; done ; } || unset -f it
  11. 1 cd "${todir}" || :
  12. 1 &>/dev/null md5sum < "$BASH_SOURCE"

scripts/comments.sh

100.0% lines covered

4 relevant lines. 4 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 case "space" in
  3. space) # comment
  4. 1 echo space
  5. ;;
  6. esac
  7. 1 case "tab" in
  8. tab) # comment
  9. 1 echo tab
  10. ;;
  11. esac

scripts/delete.sh

100.0% lines covered

6 relevant lines. 6 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 cat > tmp.sh <<'BASH'
  3. 1 #!/bin/bash
  4. 1 rm -v $0
  5. 1 BASH
  6. 1 chmod +x tmp.sh
  7. 1 ./tmp.sh

scripts/executable

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo "Although I'm extension-less, I am an executable Bash script"

scripts/exit_non_zero.sh

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 exit 21

scripts/function.sh

100.0% lines covered

7 relevant lines. 7 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. function f1 {
  3. 2 echo f1
  4. }
  5. f2() {
  6. 1 f1
  7. 1 echo f2
  8. }
  9. __a_bc()
  10. {
  11. 1 echo __a_bc
  12. }
  13. 1 f1
  14. 1 f2
  15. 1 __a_bc

scripts/long_line.sh

75.0% lines covered

4 relevant lines. 3 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. 1 echo 1 && \
  3. 1 echo 2 \
  4. 1 && echo 3 \
  5. || echo 0

scripts/multiline.sh

88.0% lines covered

25 relevant lines. 22 lines covered and 3 lines missed.
    
  1. #!/bin/bash
  2. # nil
  3. if # nil
  4. 1 [[ false = true ]] # 1
  5. then # nil
  6. echo 1 # 0
  7. elif # nil
  8. 1 [[ 2 ]] # 1
  9. then # nil
  10. 1 echo 2 # 1
  11. else # nil
  12. echo 3 # 0
  13. fi # nil
  14. # nil
  15. 1 [ false = true ] || \
  16. 2 [[ 42 -eq 1337 ]] || [[ 1 -eq 1 ]] \
  17. 1 && true && \
  18. 1 echo 'what?' || \
  19. echo 'no!'
  20. # nil
  21. # nil
  22. 2 variable=($(echo hi)) # 2
  23. # nil
  24. # nil
  25. 1 echo "after 1" \
  26. 1 "after 2" \
  27. 1 "after 3" \
  28. 1 "after 4"
  29. # nil
  30. 1 cat <<EOF
  31. 1 this is
  32. 1 a cat!
  33. 1 actually it's a $SHELL
  34. 1 EOF
  35. # nil
  36. 1 echo '
  37. 1 hello
  38. 1 there
  39. 1 '
  40. # nil
  41. 1 echo the end # 1

scripts/multiline2.sh

100.0% lines covered

37 relevant lines. 37 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo '
  3. 1 hello
  4. 1 there
  5. 1 '
  6. 1 echo '
  7. 1 Blah blah
  8. 1 Test
  9. 1 '
  10. 1 echo '
  11. 1 Try this command:
  12. 1
  13. 1 $ fubar baz
  14. 1
  15. 1 '
  16. 1 echo '
  17. 1 Your program has been compiled successfully.
  18. 1 You can use "fubar" to run it:
  19. 1
  20. 1 fubar baz
  21. 1
  22. 1 Run "fubar" for more commands.
  23. 1 '
  24. 1 synopsis='
  25. 1 Usage: fubar <PATH> [OPTIONS]
  26. 1 '
  27. 1 echo "$synopsis"
  28. getTodayQuery() {
  29. 1 read -rd '' query <<-SQL || true
  30. 1 SELECT
  31. 1 CASE
  32. 1 WHEN AREA.title IS NOT NULL THEN AREA.title
  33. 1 END,
  34. 1 TASK.title,
  35. 1 "things:///show?id=" || TASK.uuid
  36. 1 FROM TASKTABLE as TASK
  37. 1 SQL
  38. 1 echo "${query}"
  39. }
  40. 1 getTodayQuery

scripts/multiline3.sh

100.0% lines covered

4 relevant lines. 4 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo 1 \
  3. 1 2 \
  4. 1 3 \
  5. 1 4

scripts/multiline4.sh

100.0% lines covered

2 relevant lines. 2 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 var="foo \
  3. 1 bar"

scripts/nested/simple.sh

75.0% lines covered

4 relevant lines. 3 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. # basic test program
  3. 1 if true; then
  4. 1 echo 42
  5. else
  6. echo nope
  7. fi
  8. 1 echo "error on stderr" >&2

scripts/new line.sh

100.0% lines covered

2 relevant lines. 2 lines covered and 0 lines missed.
    
  1. #!/usr/bin/env bash
  2. 1 echo "Hello, world!"
  3. 2 PWD= : whoa

scripts/no_extension/bin_bash

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo "Hello from /bin/bash!"

scripts/no_extension/bin_bash_with_args

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/bin/bash -eux
  2. 1 echo "Hello from /bin/bash -eux!"

scripts/no_extension/bin_dash

0.0% lines covered

1 relevant lines. 0 lines covered and 1 lines missed.
    
  1. #!/bin/dash
  2. echo "Hello from /bin/dash!"

scripts/no_extension/usr_bin_env_bash

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/usr/bin/env bash
  2. 1 echo "Hello from /usr/bin/env bash!"

scripts/no_shebang.sh

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. # Tests that Bashcov::Detective properly detects shell scripts with
  2. # 1. A shellscript extension like .sh or .bash *and*
  3. # 2. Contents that follow valid shell syntax
  4. 1 echo "no shebang here!"

scripts/nounset.sh

66.67% lines covered

3 relevant lines. 2 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. 1 set -o nounset
  3. 1 echo "Well, now."
  4. echo "Exiting because ${THIS} is unset."

scripts/one_liner.sh

66.67% lines covered

3 relevant lines. 2 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. 2 [ "one" = "two" ] && echo nah || echo yup
  3. 1 if false
  4. then
  5. never
  6. fi

scripts/process_substitution.sh

100.0% lines covered

3 relevant lines. 3 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. function print_to_stderr {
  3. 1 echo "data" >&2
  4. }
  5. 2 print_to_stderr 2> >(cat)
  6. 4 diff <(ls -l | head -n-1) <(ls -l)

scripts/simple.sh

75.0% lines covered

4 relevant lines. 3 lines covered and 1 lines missed.
    
  1. #!/bin/bash
  2. # basic test program
  3. 1 if true; then
  4. 1 echo 42
  5. else
  6. echo nope
  7. fi
  8. 1 echo "error on stderr" >&2

scripts/source.sh

100.0% lines covered

2 relevant lines. 2 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo "I'm sourcing sourced.txt"
  3. 2 . $(dirname $0)/sourced.txt

scripts/sourced.txt

100.0% lines covered

1 relevant lines. 1 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo "I'm sourced.txt"

scripts/unicode.sh

100.0% lines covered

2 relevant lines. 2 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. # ¹²³
  3. 1 echo 'I am full of unicode characters! äéíóúü¿æ'
  4. 1 echo 'Invalid unicode follows: Halló Heimur!'

test_suite.sh

100.0% lines covered

4 relevant lines. 4 lines covered and 0 lines missed.
    
  1. #!/bin/bash
  2. 1 echo "UID=${UID}" >&2
  3. 1 echo "PS4=${PS4}" >&2
  4. 2 cd $(dirname $0)
  5. 1 find scripts -type f -perm -111 -print -exec '{}' \;