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

Unified Diff: tools/checkdeps/checkdeps.py

Issue 10806049: Add checkdeps presubmit check. Warns on new #includes of dependencies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to latest base. Created 8 years, 5 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
« PRESUBMIT.py ('K') | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checkdeps/checkdeps.py
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py
index 870e26230a7e68c487768333024385d15d9e5c01..303699c38d6564ea5c615d3cc0a24e480f8f3d26 100755
--- a/tools/checkdeps/checkdeps.py
+++ b/tools/checkdeps/checkdeps.py
@@ -231,6 +231,11 @@ def CheckDirectory(parent_rules, checkers, dir_name):
return success
+def ShouldCheckAddedIncludesInFile(file_path):
+ """Whether to check added includes in the given file."""
+ return os.path.splitext(file_path)[1] in cpp_checker.CppChecker.EXTENSIONS
+
+
def CheckAddedIncludes(added_includes):
"""This is used from PRESUBMIT.py to check new #include statements added in
the change being presubmit checked.
@@ -288,7 +293,7 @@ def CheckAddedIncludes(added_includes):
problems = []
for file_path, include_lines in added_includes:
# TODO(joi): Make this cover Java as well.
- if not os.path.splitext(file_path)[1] in cpp.EXTENSIONS:
+ if not ShouldCheckAddedIncludesInFile(file_path):
pass
rules_for_file = GetDirectoryRules(os.path.dirname(file_path))
if rules_for_file:
« PRESUBMIT.py ('K') | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698