LGTM, just small stuff. It does seem to make more sense to speed all the pre-commit checks up by having the script pass a list of the new and modified files to the check scripts instead and just have all check scripts operate on only the new/changed files. Presumably that's a much bigger time win and its pretty-much a win across all checks for ~free.
You might just make this a left-anchored regex string with 20\d\d embedded instead of YYYY and do a multiline match. No doubt you were going for bash->py transliteration though for less change.
Added a python helper for check_header.sh in git pre-commit script.
Review Request #1910 — Created March 13, 2015 and submitted
|benjyw, dturner-tw, jsirois, lahosken|
On my box this speeds up the header check from 5 seconds to a little over 1 second.build-support/bin/check_header.sh | 46 ++-------------------------------------------- build-support/bin/check_header_helper.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 44 deletions(-)
~/Src/Pants zundel/cheader * git commit -a Checking packages Checking imports Checking headers ERROR: All .py files other than __init__.py should start with the following header: # coding=utf-8 # Copyright YYYY Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) --- The following 1 file(s) do not conform: src/grody.py