| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |