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

Unified Diff: PRESUBMIT.py

Issue 11413036: Fix include order PRESUBMIT check: #if-#elif-#else (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | PRESUBMIT_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 6009243c3268a2940906392f91cada24f19e590c..2c6df724359bb6588eb10ba4c25bdb1d7c7c793d 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -559,8 +559,7 @@ def _CheckIncludeOrderInFile(input_api, f, is_source, changed_linenums):
system_include_pattern = input_api.re.compile(r'\s*#include \<.*')
custom_include_pattern = input_api.re.compile(r'\s*#include "(?P<FILE>.*)"')
- if_pattern = input_api.re.compile(r'\s*#if.*')
- endif_pattern = input_api.re.compile(r'\s*#endif.*')
+ if_pattern = input_api.re.compile(r'\s*#\s*(if|elif|else|endif).*')
contents = f.NewContents()
warnings = []
@@ -594,7 +593,7 @@ def _CheckIncludeOrderInFile(input_api, f, is_source, changed_linenums):
current_scope = []
for line in contents[line_num:]:
line_num += 1
- if if_pattern.match(line) or endif_pattern.match(line):
+ if if_pattern.match(line):
scopes.append(current_scope)
current_scope = []
elif (system_include_pattern.match(line) or
@@ -654,8 +653,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckUnwantedDependencies(input_api, output_api))
results.extend(_CheckFilePermissions(input_api, output_api))
results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api))
- # Causes a problem with content/renderer/render_view_impl.cc
- #results.extend(_CheckIncludeOrder(input_api, output_api))
+ results.extend(_CheckIncludeOrder(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698