Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: tools/presubmit.py

Issue 119239: Add a check to presubmit.py linting python and SCons files for trailing white... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/js2c.py ('k') | tools/test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
===================================================================
--- tools/presubmit.py (revision 2110)
+++ tools/presubmit.py (working copy)
@@ -137,7 +137,7 @@
or (name == 'third_party'))
IGNORE_LINT = ['flag-definitions.h']
-
+
def IgnoreFile(self, name):
return (super(CppLintProcessor, self).IgnoreFile(name)
or (name in CppLintProcessor.IGNORE_LINT))
@@ -180,10 +180,12 @@
'libraries.cc', 'libraries-empty.cc', 'jsmin.py', 'regexp-pcre.js']
IGNORE_TABS = IGNORE_COPYRIGHTS + ['unicode-test.js',
'html-comments.js']
+ NO_TRAILING_WHITESPACE_EXTENSIONS = ['py', 'SConscript', 'SConstruct']
def ProcessContents(self, name, contents):
result = True
base = basename(name)
+ extension = base.split('.').pop()
if not base in SourceProcessor.IGNORE_TABS:
if '\t' in contents:
print "%s contains tabs" % name
@@ -192,6 +194,10 @@
if not COPYRIGHT_HEADER_PATTERN.search(contents):
print "%s is missing a correct copyright header." % name
result = False
+ if extension in SourceProcessor.NO_TRAILING_WHITESPACE_EXTENSIONS:
+ if ' \n' in contents or contents.endswith(' '):
+ print "%s has trailing whitespace." % name
+ result = False
return result
def ProcessFiles(self, files):
« no previous file with comments | « tools/js2c.py ('k') | tools/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698