chore: display line numbers in output of check-env-var-annotations

This commit is contained in:
Phil Davis
2024-02-16 12:12:23 +05:45
parent fc209bdab8
commit 1d9e76f16f

View File

@@ -24,7 +24,7 @@ ERROR=0
SEMVER_REGEX="([0-9]|[1-9][0-9]*)(\.([0-9]|[1-9][0-9]*)){1,2}(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?"
QUERY_INTRO=$(git grep "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\.0))\""|grep -v "_test.go"|grep -v "vendor/")
QUERY_INTRO=$(git grep -n "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\.0))\""|grep -v "_test.go"|grep -v "vendor/")
RESULTS_INTRO=$(echo "${QUERY_INTRO}"|wc -l)
if [ "${RESULTS_INTRO}" -gt 0 ]; then
@@ -38,7 +38,7 @@ fi
# The following grep will filter out every line containing an `env` annotation
# it will ignore every line that has allready a valid `desc` annotation
QUERY_DESC=$(git grep "env:" -- '*.go' |grep -v -P "desc:\".{10,}\""|grep -v "_test.go"|grep -v "vendor/")
QUERY_DESC=$(git grep -n "env:" -- '*.go' |grep -v -P "desc:\".{10,}\""|grep -v "_test.go"|grep -v "vendor/")
RESULTS_DESC=$(echo "${QUERY_DESC}"|wc -l)
if [ "${RESULTS_DESC}" -gt 0 ]; then