summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 17:13:42 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-10 17:13:42 +0000
commitdb24f367ca444d343f79676a697ef5db4e46e9ba (patch)
treee0e2645acbd10ec7fd796d44b0841795ffd7e38b /PRESUBMIT.py
parentfd4504be3c2de832ae20aadc92d3581ac71b2d58 (diff)
downloadchromium_src-db24f367ca444d343f79676a697ef5db4e46e9ba.zip
chromium_src-db24f367ca444d343f79676a697ef5db4e46e9ba.tar.gz
chromium_src-db24f367ca444d343f79676a697ef5db4e46e9ba.tar.bz2
Add exceptions to max_cols rule.
Review URL: http://codereview.chromium.org/42019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rwxr-xr-xPRESUBMIT.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 6809548..5744641 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -64,6 +64,7 @@ def LocalChecks(input_api, output_api, max_cols=80):
Note that the whole file is checked, not only the changes.
"""
+ C_SOURCE_FILE_EXTENSIONS = ('.c', '.cc', '.cpp', '.h', '.inl')
cr_files = []
eof_files = []
results = []
@@ -103,8 +104,13 @@ def LocalChecks(input_api, output_api, max_cols=80):
local_errors.append(output_api.PresubmitError(
'%s, line %s ends with whitespaces.' %
(path, line_num)))
- # Accept lines with http:// to exceed the max_cols rule.
- if max_cols and len(line) > max_cols and not 'http://' in line:
+ # Accept lines with http://, https:// and C #define/#pragma/#include to
+ # exceed the max_cols rule.
+ if (max_cols and
+ len(line) > max_cols and
+ not 'http://' in line and
+ not 'https://' in line and
+ not (line[0] == '#' and ext in C_SOURCE_FILE_EXTENSIONS)):
local_errors.append(output_api.PresubmitError(
'%s, line %s has %s chars, please reduce to %d chars.' %
(path, line_num, len(line), max_cols)))