summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-25 11:54:59 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-25 11:54:59 +0000
commitf0a8a3137b3a8a1bbe3c5055cb4cfb175ecde52b (patch)
tree32c0da80b3e5104d40e37093a1a77dfff7f9133c /scripts
parent2c682e6192b86eccaa869c23d82cde81b4ea42d4 (diff)
downloadmorph-f0a8a3137b3a8a1bbe3c5055cb4cfb175ecde52b.tar.gz
Improve check-copyright-year error reporting
Be more verbose and exit with an error not an exception.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-copyright-year18
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/check-copyright-year b/scripts/check-copyright-year
index d72ddbc6..e72eaeea 100755
--- a/scripts/check-copyright-year
+++ b/scripts/check-copyright-year
@@ -17,13 +17,14 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from __future__ import print_function
import datetime
import re
+import sys
import cliapp
-
class CheckCopyrightYear(cliapp.Application):
pat = re.compile(r'^[ #/*]*Copyright\s+(\(C\)\s*)'
@@ -39,7 +40,8 @@ class CheckCopyrightYear(cliapp.Application):
def cleanup(self):
if not self.all_ok:
- raise cliapp.AppException('Some copyright years need fixing')
+ print('ERROR: Some copyright years need fixing', file=sys.stderr)
+ sys.exit(1)
def get_uncommitted_files(self):
filenames = set()
@@ -73,14 +75,12 @@ class CheckCopyrightYear(cliapp.Application):
if start <= year <= end:
ok = True
- if self.settings['verbose']:
- if ok:
+ if ok:
+ if self.settings['verbose']:
self.output.write('OK %s\n' % filename)
- else:
- self.output.write('BAD %s:%s:%s\n' %
- (filename, self.lineno, line.strip()))
- elif not ok:
- self.output.write('%s\n' % filename)
+ else:
+ self.output.write('BAD %s:%s:%s\n' %
+ (filename, self.lineno, line.strip()))
self.all_ok = self.all_ok and ok