<commit_before>#!/bin/bash
# Shamelessly ripped from https://github.com/sdboyer/gogl/blob/master/test-coverage.sh
# run on CI service w/something like:
#
# go get github.com/axw/gocov/gocov
# go get github.com/mattn/goveralls
# COVERALLS="-service drone.io -repotoken $COVERALLS_TOKEN" ./test-coverage.sh
#

echo "mode: count" > acc.out
fail=0

# Standard go tooling behavior is to ignore dirs with leading underscors
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
do
  if ls $dir/*.go &> /dev/null; then
    go test -covermode=count -coverprofile=profile.out $dir || fail=1
    if [ -f profile.out ]
    then
      cat profile.out | grep -v "^mode: " | grep -v "test_helpers.go" >> acc.out
      rm profile.out
    fi
  fi
done

# Failures have incomplete results, so don't send
if [ -z "$COVERALLS" ]; then
  go tool cover -html=acc.out
elif [ "$fail" -eq 0 ]; then
  goveralls -v -coverprofile=acc.out $COVERALLS
fi

rm -f acc.out

exit $fail<commit_msg>Ignore the easyssh.go and util/*.go for test coverage<commit_after>#!/bin/bash
# Shamelessly ripped from https://github.com/sdboyer/gogl/blob/master/test-coverage.sh
# run on CI service w/something like:
#
# go get github.com/axw/gocov/gocov
# go get github.com/mattn/goveralls
# COVERALLS="-service drone.io -repotoken $COVERALLS_TOKEN" ./test-coverage.sh
#
# NOTE: go files in the root and in the dir "utils" are ignored for purposes of
#       test coverage calculation.

set -eo pipefail

echo "mode: count" > acc.out
fail=0

want-coverage-for() {
    if [[ $1 == . || $1 == ./util ]]; then
        return 1
    fi
}

# Standard go tooling behavior is to ignore dirs with leading underscors
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
do
  if ls $dir/*.go &> /dev/null; then
    go test -covermode=count -coverprofile=profile.out $dir || fail=1
    if [ -f profile.out ] && want-coverage-for $dir
    then
      cat profile.out | grep -v "^mode: " | grep -v "test_helpers.go" >> acc.out
      rm profile.out
    fi
  fi
done

# Failures have incomplete results, so don't send
if [ -z "$COVERALLS" ]; then
  go tool cover -html=acc.out
elif [ "$fail" -eq 0 ]; then
  goveralls -v -coverprofile=acc.out $COVERALLS
fi

rm -f acc.out

exit $fail
{'fraction_non_alphanumeric': 0.1397802197802198, 'fraction_numerical': 0.005714285714285714, 'mean_word_length': 3.0354609929078014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7273143', 'n_tokens_mistral': 863, 'n_tokens_neox': 833, 'n_words': 261}