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

Side by Side Diff: PRESUBMIT.py

Issue 945143006: PRESUBMIT: UMA histogram check, rewind histograms.xml file between unmatched_histograms searches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« 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 """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
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
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
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