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

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: Respond to review comments. 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
« no previous file with comments | « 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 c08f0414542c061b256fc29ce4edc5d537f0cb95..d2a2ee02c9d7ee65ac6eaab7160d82c8b615f62f 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):
M-A Ruel 2012/07/26 14:03:28 ShouldcheckIncludesInCppFile ? Just to be clearer
+ """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):
M-A Ruel 2012/07/26 14:03:28 I'd like to have Cpp here too but this is outside
"""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:
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698