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

Unified Diff: PRESUBMIT.py

Issue 42019: Add exceptions to max_cols rule. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
===================================================================
--- PRESUBMIT.py (revision 11334)
+++ PRESUBMIT.py (working copy)
@@ -64,6 +64,7 @@
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 @@
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)))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698