Skip to content

Commit

Permalink
(#18) Fix ignore of untested packages in coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
llorllale committed Feb 26, 2019
1 parent b52f151 commit 6343916
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

0 comments on commit 6343916

Please sign in to comment.