Skip to content

Commit

Permalink
Clearer output from lint scripts (jaegertracing#5820)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Aug 9, 2024
1 parent f250716 commit a6ccf56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/check-goleak-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
set -euo pipefail

bad_pkgs=0
total_pkgs=0
failed_pkgs=0

# shellcheck disable=SC2048
for dir in $*; do
((total_pkgs+=1))
if [[ -f "${dir}/.nocover" ]]; then
continue
fi
Expand All @@ -22,19 +24,18 @@ for dir in $*; do
fi
done
if ((good == 0)); then
echo "🔴 Error(check-goleak): no goleak check in package ${dir}"
echo "Error(check-goleak): no goleak check in package ${dir}"
((bad_pkgs+=1))
if [[ "${dir}" == "./cmd/jaeger/internal/integration/" || "${dir}" == "./plugin/storage/integration/" ]]; then
echo " this package is temporarily allowed and will not cause linter failure"
echo " ... this package is temporarily allowed and will not cause linter failure"
else
((failed_pkgs+=1))
fi
fi
done

function help() {
echo " See https://github.com/jaegertracing/jaeger/pull/5010/files"
echo " for examples of adding the checks."
echo " See pkg/version/package_test.go as example of adding the checks."
}

if ((failed_pkgs > 0)); then
Expand All @@ -44,4 +45,6 @@ if ((failed_pkgs > 0)); then
elif ((bad_pkgs > 0)); then
echo "🐞 Warning(check-goleak): no goleak check in ${bad_pkgs} package(s)."
help
else
echo "✅ Info(check-goleak): no issues after scanning ${total_pkgs} package(s)."
fi
4 changes: 4 additions & 0 deletions scripts/check-test-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
set -euo pipefail

NO_TEST_FILE_DIRS=""
total_pkgs=0

# shellcheck disable=SC2048
for dir in $*; do
((total_pkgs+=1))
mainFile=$(find "${dir}" -maxdepth 1 -name 'main.go')
testFiles=$(find "${dir}" -maxdepth 1 -name '*_test.go')
if [ -z "${testFiles}" ]; then
Expand Down Expand Up @@ -42,4 +44,6 @@ if [ -n "${NO_TEST_FILE_DIRS}" ]; then
echo "error: at least one *_test.go file must be in all directories with go files so that they are counted for code coverage" >&2
echo " if no tests are possible for a package (e.g. it only defines types), create empty_test.go" >&2
exit 1
else
echo "✅ Info(check-test-files): no issues after scanning ${total_pkgs} package(s)."
fi

0 comments on commit a6ccf56

Please sign in to comment.