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

Unified Diff: tools/checkdeps/cpp_checker.py

Issue 10823271: Add ability to write include rules specific to subsets of files in a directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 8 years, 4 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 | « tools/checkdeps/checkdeps_test.py ('k') | tools/checkdeps/java_checker.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checkdeps/cpp_checker.py
diff --git a/tools/checkdeps/cpp_checker.py b/tools/checkdeps/cpp_checker.py
index 30241a16a11b23cb47dd7b54360083ec8ded5036..b975c1980183ab43dbbada8c984023a51c86c626 100644
--- a/tools/checkdeps/cpp_checker.py
+++ b/tools/checkdeps/cpp_checker.py
@@ -36,7 +36,7 @@ class CppChecker(object):
def __init__(self, verbose):
self._verbose = verbose
- def CheckLine(self, rules, line, fail_on_temp_allow=False):
+ def CheckLine(self, rules, line, dependee_path, fail_on_temp_allow=False):
"""Checks the given line with the given rule set.
Returns a tuple (is_include, dependency_violation) where
@@ -62,7 +62,7 @@ class CppChecker(object):
print ' WARNING: directory specified with no path: ' + include_path
return True, None
- rule = rules.RuleApplyingTo(include_path)
+ rule = rules.RuleApplyingTo(include_path, dependee_path)
if (rule.allow == Rule.DISALLOW or
(fail_on_temp_allow and rule.allow == Rule.TEMP_ALLOW)):
return True, results.DependencyViolation(include_path, rule, rules)
@@ -94,7 +94,7 @@ class CppChecker(object):
in_if0 -= 1
continue
- is_include, violation = self.CheckLine(rules, line)
+ is_include, violation = self.CheckLine(rules, line, filepath)
if is_include:
last_include = line_num
if violation:
« no previous file with comments | « tools/checkdeps/checkdeps_test.py ('k') | tools/checkdeps/java_checker.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698