kubernetes/hooks
Eric Paris b503214fee Fix boilerplate check crash if .go file has no comments
Clayton pointed out that if he created a file with no /* in it anywhere
the boilerplate logic would crash like:

$ hack/verify-boilerplate.sh
Traceback (most recent call last):
  File "hack/../hooks/boilerplate.py", line 87, in <module>
    sys.exit(main())
  File "hack/../hooks/boilerplate.py", line 83, in main
    if not file_passes(filename, extention, ref, p):
  File "hack/../hooks/boilerplate.py", line 38, in file_passes
    while data[0] != "/*\n":
IndexError: list index out of range

That is because we were just stripping everything before the first line
that contained exacly "/*".  If no such line existed it got to the end
and just kept going.

This does something smarter. We use a regex to look for one or more
lines which start // +build followed by a single newline and remove only
those.  This obviously found one place where the package name was above
the license and was being missed by both the old and the new checker.

It also fixed the python spew and just tells you your file fails.
2015-05-08 17:30:40 -04:00
..
boilerplate.go.txt Make copyright ownership statement generic 2015-05-01 17:49:56 -04:00
boilerplate.py Fix boilerplate check crash if .go file has no comments 2015-05-08 17:30:40 -04:00
boilerplate.py.txt Check python files for valid license boilerplate 2015-05-04 18:37:47 -04:00
boilerplate.sh.txt Make copyright ownership statement generic 2015-05-01 17:49:56 -04:00
commit-msg Slightly friendlier pre-commit errors. 2014-06-24 15:01:08 -07:00
description.sh Make copyright ownership statement generic 2015-05-01 17:49:56 -04:00
prepare-commit-msg Check python files for valid license boilerplate 2015-05-04 18:37:47 -04:00