Skip to content

Commit

Permalink
Move description.sh from hack/ to hooks/
Browse files Browse the repository at this point in the history
Just to get everything in one place...
  • Loading branch information
eparis committed Aug 11, 2015
1 parent 302cb7d commit 985fa94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 37 deletions.
23 changes: 14 additions & 9 deletions hack/verify-description.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ find_files() {
-o -wholename '*/third_party/*' \
-o -wholename '*/Godeps/*' \
\) -prune \
\) -name '*.go'
\) -wholename '*pkg/api/v*/types.go'
}

files=`find_files | egrep "pkg/api/v.[^/]*/types\.go"`

for file in $files
do
if [[ "$("${KUBE_ROOT}/hooks/description.sh" "${file}")" -eq "0" ]]; then
echo "API file is missing the required field descriptions: ${file}"
result=1
fi
if [[ $# -eq 0 ]]; then
files=`find_files | egrep "pkg/api/v.[^/]*/types\.go"`
else
files=("${@}")
fi

for file in $files; do
if grep json: "${file}" | grep -v // | grep -v ,inline | grep -v -q description: ; then
echo "API file is missing the required field descriptions: ${file}"
result=1
fi
done

exit ${result}

# ex: ts=2 sw=2 et filetype=sh
26 changes: 0 additions & 26 deletions hooks/description.sh

This file was deleted.

6 changes: 4 additions & 2 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ files_need_description=()
# Check API schema definitions for field descriptions
for file in $(git diff --cached --name-only --diff-filter ACM | egrep "pkg/api/v.[^/]*/types\.go" | grep -v "third_party"); do
# Check for files with fields without description tags
descriptionless=$("${KUBE_HOOKS_DIR}/description.sh" "${file}")
if [[ "$descriptionless" -eq "0" ]]; then
descriptionless=$(hack/verify-description.sh "${file}")
if [[ "$descriptionless" != "" ]]; then
files_need_description+=("${file}")
fi
done
Expand Down Expand Up @@ -141,3 +141,5 @@ if [[ "${exit_code}" != 0 ]]; then
echo "${red}Aborting commit${reset}"
fi
exit ${exit_code}

# ex: ts=2 sw=2 et filetype=sh

0 comments on commit 985fa94

Please sign in to comment.