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

Side by Side Diff: third_party/WebKit/Source/core/frame/PRESUBMIT.py

Issue 2797043002: Add a presubmit checker for duplicated enum values in UseCounter::Feature (Closed)
Patch Set: Codereview: nit Created 3 years, 8 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Blink frame presubmit script 5 """Blink frame presubmit script
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 gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 source_path = '' 67 source_path = ''
68 for f in input_api.AffectedFiles(): 68 for f in input_api.AffectedFiles():
69 if f.LocalPath().endswith('UseCounter.h'): 69 if f.LocalPath().endswith('UseCounter.h'):
70 source_path = f.LocalPath() 70 source_path = f.LocalPath()
71 break 71 break
72 else: 72 else:
73 return [] 73 return []
74 74
75 START_MARKER = '^enum Feature : uint32_t {' 75 START_MARKER = '^enum Feature : uint32_t {'
76 END_MARKER = '^NumberOfFeatures' 76 END_MARKER = '^NumberOfFeatures'
77 if update_histogram_enum.HistogramNeedsUpdate( 77 should_update_histogram, duplicated_values = update_histogram_enum.Histogram NeedsUpdate(
Ilya Sherman 2017/04/13 01:12:49 Should this wrap to 80-col?
78 histogram_enum_name='FeatureObserver', 78 histogram_enum_name='FeatureObserver',
79 source_enum_path=source_path, 79 source_enum_path=source_path,
80 start_marker=START_MARKER, 80 start_marker=START_MARKER,
81 end_marker=END_MARKER): 81 end_marker=END_MARKER)
82 if duplicated_values:
83 return [output_api.PresubmitPromptWarning(
84 'UseCounter::Feature has been updated and there exists duplicated '
85 'values between (%s) and (%s)' % duplicated_values,
86 items=[source_path])]
87 if should_update_histogram:
82 return [output_api.PresubmitPromptWarning( 88 return [output_api.PresubmitPromptWarning(
83 'UseCounter::Feature has been updated and the UMA mapping needs to ' 89 'UseCounter::Feature has been updated and the UMA mapping needs to '
84 'be regenerated. Please run update_use_counter_feature_enum.py in ' 90 'be regenerated. Please run update_use_counter_feature_enum.py in '
85 'src/tools/metrics/histograms/ to update the mapping.', 91 'src/tools/metrics/histograms/ to update the mapping.',
86 items=[source_path])] 92 items=[source_path])]
87 93
88 return [] 94 return []
89 95
90 96
91 def CheckChangeOnUpload(input_api, output_api): 97 def CheckChangeOnUpload(input_api, output_api):
92 results = [] 98 results = []
93 results.extend(_RunUseCounterChecks(input_api, output_api)) 99 results.extend(_RunUseCounterChecks(input_api, output_api))
94 results.extend(_RunUmaHistogramChecks(input_api, output_api)) 100 results.extend(_RunUmaHistogramChecks(input_api, output_api))
95 return results 101 return results
96 102
97 103
98 def CheckChangeOnCommit(input_api, output_api): 104 def CheckChangeOnCommit(input_api, output_api):
99 results = [] 105 results = []
100 results.extend(_RunUseCounterChecks(input_api, output_api)) 106 results.extend(_RunUseCounterChecks(input_api, output_api))
101 results.extend(_RunUmaHistogramChecks(input_api, output_api)) 107 results.extend(_RunUmaHistogramChecks(input_api, output_api))
102 return results 108 return results
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/update_histogram_enum.py » ('j') | tools/metrics/histograms/update_histogram_enum.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698