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 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 histogram_name_found = _FindHistogramNameInLine(histogram_info[0], line) | 399 histogram_name_found = _FindHistogramNameInLine(histogram_info[0], line) |
400 if histogram_name_found: | 400 if histogram_name_found: |
401 break | 401 break |
402 if not histogram_name_found: | 402 if not histogram_name_found: |
403 unmatched_histograms.append(histogram_info) | 403 unmatched_histograms.append(histogram_info) |
404 | 404 |
405 problems = [] | 405 problems = [] |
406 if unmatched_histograms: | 406 if unmatched_histograms: |
407 with open('tools/metrics/histograms/histograms.xml') as histograms_xml: | 407 with open('tools/metrics/histograms/histograms.xml') as histograms_xml: |
408 for histogram_name, f, line_num in unmatched_histograms: | 408 for histogram_name, f, line_num in unmatched_histograms: |
| 409 histograms_xml.seek(0) |
409 histogram_name_found = False | 410 histogram_name_found = False |
410 for line in histograms_xml: | 411 for line in histograms_xml: |
411 histogram_name_found = _FindHistogramNameInLine(histogram_name, line) | 412 histogram_name_found = _FindHistogramNameInLine(histogram_name, line) |
412 if histogram_name_found: | 413 if histogram_name_found: |
413 break | 414 break |
414 if not histogram_name_found: | 415 if not histogram_name_found: |
415 problems.append(' [%s:%d] %s' % | 416 problems.append(' [%s:%d] %s' % |
416 (f.LocalPath(), line_num, histogram_name)) | 417 (f.LocalPath(), line_num, histogram_name)) |
417 | 418 |
418 if not problems: | 419 if not problems: |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 # Explicitly iterate over copies of dicts since we mutate them. | 1759 # Explicitly iterate over copies of dicts since we mutate them. |
1759 for master in builders.keys(): | 1760 for master in builders.keys(): |
1760 for builder in builders[master].keys(): | 1761 for builder in builders[master].keys(): |
1761 # Do not trigger presubmit builders, since they're likely to fail | 1762 # Do not trigger presubmit builders, since they're likely to fail |
1762 # (e.g. OWNERS checks before finished code review), and we're | 1763 # (e.g. OWNERS checks before finished code review), and we're |
1763 # running local presubmit anyway. | 1764 # running local presubmit anyway. |
1764 if 'presubmit' in builder: | 1765 if 'presubmit' in builder: |
1765 builders[master].pop(builder) | 1766 builders[master].pop(builder) |
1766 | 1767 |
1767 return builders | 1768 return builders |
OLD | NEW |