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

Unified Diff: PRESUBMIT.py

Issue 2897383002: Revert of Add presubmit rule banning relative header includes (Closed)
Patch Set: Created 3 years, 7 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
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 8af2e6749d11732536c0351139fa3a258f7bc1b7..4ba36c1e391eb6f7a314e8df636bce7aa1c2cad4 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -2157,43 +2157,6 @@
https://chromium.googlesource.com/chromium/src/+/master/docs/es6_chromium.md#Arrow-Functions
""" % "\n".join(" %s:%d\n" % line for line in arrow_lines))]
-
-def _CheckForRelativeIncludes(input_api, output_api):
- from cpp_checker import CppChecker
-
- bad_files = {}
- for f in input_api.AffectedFiles(include_deletes=False):
- if (f.LocalPath().startswith('third_party') and
- not f.LocalPath().startswith('third_party/WebKit') and
- not f.LocalPath().startswith('third_party\\WebKit')):
- continue
-
- if not CppChecker.IsCppFile(f.LocalPath()):
- continue
-
- relative_includes = [line for line_num, line in f.ChangedContents()
- if "#include" in line and "../" in line]
- bad_files[f.LocalPath()] = relative_includes
-
- if not bad_files:
- return []
-
- error_descriptions = []
- for file_path, bad_lines in bad_files.iteritems():
- error_description = file_path
- for line in bad_lines:
- error_description += '\n ' + line
- error_descriptions.append(error_description)
-
- results = []
- results.append(output_api.PresubmitError(
- 'You added one or more relative #include paths (including "../").\n'
- 'These shouldn\'t be used because they can be used to include headers\n'
- 'from code that\'s not correctly specified as a dependency in the\n'
- 'relevant BUILD.gn file(s).',
- error_descriptions))
-
- return results
def _AndroidSpecificOnUploadChecks(input_api, output_api):
"""Groups checks that target android code."""
@@ -2256,7 +2219,6 @@
results.extend(_CheckIpcOwners(input_api, output_api))
results.extend(_CheckUselessForwardDeclarations(input_api, output_api))
results.extend(_CheckForRiskyJsFeatures(input_api, output_api))
- results.extend(_CheckForRelativeIncludes(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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698