components/autofill/PRESUBMIT.py
def _CheckNoServerFieldTypeCasts(input_api, output_api):
  """Checks that no files cast (e.g., raw integers to) ServerFieldTypes."""
  pattern = input_api.re.compile(
      r'_cast<\s*ServerFieldType\b',
      input_api.re.MULTILINE)
  files = []
  for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
    if (f.LocalPath().startswith('components/autofill/') and
        not f.LocalPath().endswith("PRESUBMIT.py")):
      contents = input_api.ReadFile(f)
      if pattern.search(contents):
        files.append(f)

  if len(files):
    return [ output_api.PresubmitPromptWarning(
        'Do not cast raw integers to ServerFieldType to prevent values that ' +
        'have no corresponding enum constant or are deprecated. Use '+
        'ToSafeServerFieldType() instead.',
        files) ]
  return []
Checks that no files cast (e.g., raw integers to) ServerFieldTypes.
Checks that no files cast  ServerFieldTypes.
Checks that no files cast ServerFieldTypes .
def _CheckNoServerFieldTypeCasts(input_api, output_api):
  pattern = input_api.re.compile(
      r'_cast<\s*ServerFieldType\b',
      input_api.re.MULTILINE)
  files = []
  for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
    if (f.LocalPath().startswith('components/autofill/') and
        not f.LocalPath().endswith("PRESUBMIT.py")):
      contents = input_api.ReadFile(f)
      if pattern.search(contents):
        files.append(f)
  if len(files):
    return [ output_api.PresubmitPromptWarning(
        'Do not cast raw integers to ServerFieldType to prevent values that ' +
        'have no corresponding enum constant or are deprecated. Use '+
        'ToSafeServerFieldType() instead.',
        files) ]
  return []
def _CheckNoServerFieldTypeCasts ( input_api , output_api ) : pattern = input_api . re . compile ( r'_cast<\s*ServerFieldType\b' , input_api . re . MULTILINE ) files = [ ] for f in input_api . AffectedSourceFiles ( input_api . FilterSourceFile ) : if ( f . LocalPath ( ) . startswith ( 'components/autofill/' ) and not f . LocalPath ( ) . endswith ( "PRESUBMIT.py" ) ) : contents = input_api . ReadFile ( f ) if pattern . search ( contents ) : files . append ( f ) if len ( files ) : return [ output_api . PresubmitPromptWarning ( 'Do not cast raw integers to ServerFieldType to prevent values that ' + 'have no corresponding enum constant or are deprecated. Use ' + 'ToSafeServerFieldType() instead.' , files ) ] return [ ]
Checks that no files cast (e.g., raw integers to) ServerFieldTypes.
Checks that no files cast ( e . g . raw integers to ) ServerFieldTypes .
"""Checks that no files cast (e.g., raw integers to) ServerFieldTypes."""
input_api
output_api