Skip to content

Commit

Permalink
(#18) Fix ignore of untested packages in coverage check (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
llorllale committed Feb 26, 2019
1 parent b52f151 commit 8162e43
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions check_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
#

let THRESHOLD=80
IGNORE=github.com/llorllale/go-gitlint/cmd/go-gitlint

let exit_code=0

# @todo #16 The coverage script is ignoring packages that are not tested
# at all (0% coverage). It should be fixed so that all packages are
# tested (except for main).
while read line; do
if [ "$(echo $line | grep coverage)" != "" ]; then
pkg=$(echo $line | sed 's/\s\+/ /g' | sed 's/%//' | cut -d ' ' -f 2)
pkg=$(echo $line | sed 's/\s\+/ /g' | sed 's/%//' | cut -d ' ' -f 2)
if [[ "$(echo $line | grep 'no test files')" != "" && "$pkg" != "$IGNORE" ]]; then
echo "No coverage for package [$pkg]"
let exit_code++
elif [[ "$(echo $line | grep coverage)" != "" ]]; then
cov=$(echo $line | sed 's/\s\+/ /g' | sed 's/%//' | cut -d ' ' -f 5)
if [ 1 -eq $(echo "$THRESHOLD > $cov" | bc) ]; then
echo "Coverage [$cov] for package [$pkg] is below threshold [$THRESHOLD]"
Expand Down

1 comment on commit 8162e43

@0pdd
Copy link

@0pdd 0pdd commented on 8162e43 Feb 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 16-e0d2cf8f disappeared from check_coverage.sh, that's why I closed #18. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.