| Index: tools/presubmit.py
|
| diff --git a/tools/presubmit.py b/tools/presubmit.py
|
| index c191fc7497045d86794078badcb5b685b278ea77..7b4719f4762725a0771bae77eddac28a031a456d 100755
|
| --- a/tools/presubmit.py
|
| +++ b/tools/presubmit.py
|
| @@ -1,6 +1,6 @@
|
| #!/usr/bin/env python
|
| #
|
| -# Copyright 2008 the V8 project authors. All rights reserved.
|
| +# Copyright 2011 the V8 project authors. All rights reserved.
|
| # Redistribution and use in source and binary forms, with or without
|
| # modification, are permitted provided that the following conditions are
|
| # met:
|
| @@ -88,7 +88,6 @@ whitespace/blank_line
|
| whitespace/braces
|
| whitespace/comma
|
| whitespace/comments
|
| -whitespace/end_of_line
|
| whitespace/ending_newline
|
| whitespace/indent
|
| whitespace/labels
|
| @@ -231,11 +230,12 @@ COPYRIGHT_HEADER_PATTERN = re.compile(
|
|
|
| class SourceProcessor(SourceFileProcessor):
|
| """
|
| - Check that all files include a copyright notice.
|
| + Check that all files include a copyright notice and no trailing whitespaces.
|
| """
|
|
|
| RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript',
|
| - 'SConstruct', '.status']
|
| + 'SConstruct', '.status', '.gyp', '.gypi']
|
| +
|
| def IsRelevant(self, name):
|
| for ext in SourceProcessor.RELEVANT_EXTENSIONS:
|
| if name.endswith(ext):
|
| @@ -273,6 +273,22 @@ class SourceProcessor(SourceFileProcessor):
|
| if not COPYRIGHT_HEADER_PATTERN.search(contents):
|
| print "%s is missing a correct copyright header." % name
|
| result = False
|
| + ext = base.split('.').pop()
|
| + if ' \n' in contents or contents.endswith(' '):
|
| + line = 0
|
| + lines = []
|
| + parts = contents.split(' \n')
|
| + if not contents.endswith(' '):
|
| + parts.pop()
|
| + for part in parts:
|
| + line += part.count('\n') + 1
|
| + lines.append(str(line))
|
| + linenumbers = ', '.join(lines)
|
| + if len(lines) > 1:
|
| + print "%s has trailing whitespaces in lines %s." % (name, linenumbers)
|
| + else:
|
| + print "%s has trailing whitespaces in line %s." % (name, linenumbers)
|
| + result = False
|
| return result
|
|
|
| def ProcessFiles(self, files, path):
|
|
|