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

Unified Diff: tools/checkdeps/java_checker.py

Issue 10832062: Add ability to format errors as a list of temp-allow rules to paste (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
Index: tools/checkdeps/java_checker.py
diff --git a/tools/checkdeps/java_checker.py b/tools/checkdeps/java_checker.py
index cc6fe66815a4131307513d676e6bc807ca69884c..d6633b8351b95d5edb02eb7a3b222aee2b547ae5 100644
--- a/tools/checkdeps/java_checker.py
+++ b/tools/checkdeps/java_checker.py
@@ -8,6 +8,7 @@ import codecs
import os
import re
+import results
from rules import Rule
@@ -83,7 +84,7 @@ class JavaChecker(object):
if self._verbose:
print 'Checking: ' + filepath
- result = ''
+ dependee_status = results.DependeeStatus(filepath)
with codecs.open(filepath, encoding='utf-8') as f:
for line in f:
for clazz in re.findall('^import\s+(?:static\s+)?([\w\.]+)\s*;', line):
@@ -95,14 +96,12 @@ class JavaChecker(object):
self._classmap[clazz], self._base_directory)
# Convert Windows paths to Unix style, as used in DEPS files.
include_path = include_path.replace(os.path.sep, '/')
- (allowed, why_failed) = rules.DirAllowed(include_path)
- if allowed == Rule.DISALLOW:
- if self._verbose:
- result += '\nFor %s' % rules
- result += 'Illegal include: "%s"\n Because of %s\n' % (
- include_path, why_failed)
+ rule = rules.RuleApplyingTo(include_path)
+ if rule.allow == Rule.DISALLOW:
+ dependee_status.AddViolation(
+ results.DependencyViolation(include_path, rule, rules))
erikwright (departed) 2012/07/31 17:22:46 I note that you don't check for 'fail_on_temp_allo
Jói 2012/08/01 15:22:58 I might do this as a follow-up change; making the
if '{' in line:
# This is code, so we're finished reading imports for this file.
break
- return result
+ return dependee_status

Powered by Google App Engine
This is Rietveld 408576698