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

Side by Side Diff: tools/checkdeps/results.py

Issue 75793003: Make checkdeps.py correctly signal failure when using --json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | 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 import json 9 import json
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } for violation in dependee_status.violations] 119 } for violation in dependee_status.violations]
120 }) 120 })
121 121
122 if self.wrapped_formatter: 122 if self.wrapped_formatter:
123 self.wrapped_formatter.AddError(dependee_status) 123 self.wrapped_formatter.AddError(dependee_status)
124 124
125 def GetResults(self): 125 def GetResults(self):
126 with open(self.output_path, 'w') as f: 126 with open(self.output_path, 'w') as f:
127 f.write(json.dumps(self.results)) 127 f.write(json.dumps(self.results))
128 128
129 return self.results
129 130
130 def PrintResults(self): 131 def PrintResults(self):
131 if self.wrapped_formatter: 132 if self.wrapped_formatter:
132 self.wrapped_formatter.PrintResults() 133 self.wrapped_formatter.PrintResults()
133 return 134 return
134 135
135 print self.results 136 print self.results
136 137
137 138
138 class TemporaryRulesFormatter(ResultsFormatter): 139 class TemporaryRulesFormatter(ResultsFormatter):
(...skipping 29 matching lines...) Expand all
168 self.count = 0 169 self.count = 0
169 170
170 def AddError(self, dependee_status): 171 def AddError(self, dependee_status):
171 self.count += len(dependee_status.violations) 172 self.count += len(dependee_status.violations)
172 173
173 def GetResults(self): 174 def GetResults(self):
174 return '%d' % self.count 175 return '%d' % self.count
175 176
176 def PrintResults(self): 177 def PrintResults(self):
177 print self.count 178 print self.count
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698