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

Side by Side Diff: components/sync/PRESUBMIT.py

Issue 2335413002: Extend message for sync presubmit (Closed)
Patch Set: clean up Created 4 years, 3 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) 2016 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2016 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 """Presubmit script for sync 5 """Presubmit script for sync
6 This checks that ModelTypeInfo entries in model_type.cc follow conventions. 6 This checks that ModelTypeInfo entries in model_type.cc follow conventions.
7 See CheckModelTypeInfoMap or model_type.cc for more detail on the rules. 7 See CheckModelTypeInfoMap or model_type.cc for more detail on the rules.
8 """ 8 """
9 9
10 import os 10 import os
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 A potentially empty list of PresubmitError objects corresponding to 254 A potentially empty list of PresubmitError objects corresponding to
255 violations of the above rule 255 violations of the above rule
256 """ 256 """
257 if map_entry.field_number == '-1': 257 if map_entry.field_number == '-1':
258 return [] 258 return []
259 proto_message_name = proto_field_definitions[ 259 proto_message_name = proto_field_definitions[
260 FieldNumberToPrototypeString(map_entry.field_number)] 260 FieldNumberToPrototypeString(map_entry.field_number)]
261 if map_entry.notification_type.lower() != proto_message_name: 261 if map_entry.notification_type.lower() != proto_message_name:
262 return [ 262 return [
263 FormatPresubmitError( 263 FormatPresubmitError(
264 output_api,'notification type "%s" does not match proto message' 264 output_api,'In the construction of ModelTypeInfo: notification type'
265 ' "%s" does not match proto message'
265 ' name defined in sync.proto: ' '"%s"' % 266 ' name defined in sync.proto: ' '"%s"' %
266 (map_entry.notification_type, proto_message_name), 267 (map_entry.notification_type, proto_message_name),
267 map_entry.affected_lines)] 268 map_entry.affected_lines)]
268 return [] 269 return []
269 270
270 271
271 def CheckNoDuplicatedFieldValues(output_api, map_entries): 272 def CheckNoDuplicatedFieldValues(output_api, map_entries):
272 """Check that map_entries has no duplicated field values. 273 """Check that map_entries has no duplicated field values.
273 Verifies that every map_entry in map_entries doesn't have a field value 274 Verifies that every map_entry in map_entries doesn't have a field value
274 used elsewhere in map_entries, ignoring special values ("" and -1). 275 used elsewhere in map_entries, ignoring special values ("" and -1).
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 Args: 351 Args:
351 field_number: string representation of a field number enum reference 352 field_number: string representation of a field number enum reference
352 Returns: 353 Returns:
353 A string that is the corresponding proto field data type. e.g. 354 A string that is the corresponding proto field data type. e.g.
354 FieldNumberToPrototypeString('EntitySpecifics::kAppFieldNumber') 355 FieldNumberToPrototypeString('EntitySpecifics::kAppFieldNumber')
355 => 'AppSpecifics' 356 => 'AppSpecifics'
356 """ 357 """
357 return field_number.replace(FIELD_NUMBER_PREFIX, '').replace( 358 return field_number.replace(FIELD_NUMBER_PREFIX, '').replace(
358 'FieldNumber', 'Specifics').replace( 359 'FieldNumber', 'Specifics').replace(
359 'AppNotificationSpecifics', 'AppNotification') 360 'AppNotificationSpecifics', 'AppNotification')
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