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

Side by Side Diff: tools/checkdeps/results.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/checkdeps/java_checker.py ('k') | tools/checkdeps/rules.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 """Results object and results formatters for checkdeps tool.""" 6 """Results object and results formatters for checkdeps tool."""
7 7
8 8
9 class DependencyViolation(object): 9 class DependencyViolation(object):
10 """A single dependency violation.""" 10 """A single dependency violation."""
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 lines = [] 75 lines = []
76 lines.append('\nERROR in %s' % dependee_status.dependee_path) 76 lines.append('\nERROR in %s' % dependee_status.dependee_path)
77 for violation in dependee_status.violations: 77 for violation in dependee_status.violations:
78 lines.append(self.FormatViolation(violation, self.verbose)) 78 lines.append(self.FormatViolation(violation, self.verbose))
79 self.results.append('\n'.join(lines)) 79 self.results.append('\n'.join(lines))
80 80
81 @staticmethod 81 @staticmethod
82 def FormatViolation(violation, verbose=False): 82 def FormatViolation(violation, verbose=False):
83 lines = [] 83 lines = []
84 if verbose: 84 if verbose:
85 lines.append('For %s' % violation.rules) 85 lines.append(' For %s' % violation.rules)
86 lines.append( 86 lines.append(
87 ' Illegal include: "%s"\n Because of %s' % 87 ' Illegal include: "%s"\n Because of %s' %
88 (violation.include_path, str(violation.violated_rule))) 88 (violation.include_path, str(violation.violated_rule)))
89 return '\n'.join(lines) 89 return '\n'.join(lines)
90 90
91 def GetResults(self): 91 def GetResults(self):
92 return self.results 92 return self.results
93 93
94 def PrintResults(self): 94 def PrintResults(self):
95 for result in self.results: 95 for result in self.results:
(...skipping 14 matching lines...) Expand all
110 def AddError(self, dependee_status): 110 def AddError(self, dependee_status):
111 for violation in dependee_status.violations: 111 for violation in dependee_status.violations:
112 self.violations.add(violation.include_path) 112 self.violations.add(violation.include_path)
113 113
114 def GetResults(self): 114 def GetResults(self):
115 return [' "!%s",' % path for path in sorted(self.violations)] 115 return [' "!%s",' % path for path in sorted(self.violations)]
116 116
117 def PrintResults(self): 117 def PrintResults(self):
118 for result in self.GetResults(): 118 for result in self.GetResults():
119 print result 119 print result
OLDNEW
« no previous file with comments | « tools/checkdeps/java_checker.py ('k') | tools/checkdeps/rules.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698