ios/PRESUBMIT.py
def _CheckARCCompilationGuard(input_api, output_api):
  """ Checks whether new objc files have proper ARC compile guards."""
  files_without_headers = []
  for f in input_api.AffectedFiles():
    if f.Action() != 'A':
      continue

    _, ext = os.path.splitext(f.LocalPath())
    if ext not in ('.m', '.mm'):
      continue

    if not IsSubListOf(ARC_COMPILE_GUARD, f.NewContents()):
      files_without_headers.append(f.LocalPath())

  if not files_without_headers:
    return []

  plural_suffix = '' if len(files_without_headers) == 1 else 's'
  error_message = '\n'.join([
      'Found new Objective-C implementation file%(plural)s without compile'
      ' guard%(plural)s. Please use the following compile guard'
      ':' % {'plural': plural_suffix}
  ] + ARC_COMPILE_GUARD + files_without_headers) + '\n'

  return [output_api.PresubmitError(error_message)]
 Checks whether new objc files have proper ARC compile guards.
Checks whether new objc files have proper ARC compile guards.
Checks whether new objc files have proper ARC compile guards .
def _CheckARCCompilationGuard(input_api, output_api):
  files_without_headers = []
  for f in input_api.AffectedFiles():
    if f.Action() != 'A':
      continue
    _, ext = os.path.splitext(f.LocalPath())
    if ext not in ('.m', '.mm'):
      continue
    if not IsSubListOf(ARC_COMPILE_GUARD, f.NewContents()):
      files_without_headers.append(f.LocalPath())
  if not files_without_headers:
    return []
  plural_suffix = '' if len(files_without_headers) == 1 else 's'
  error_message = '\n'.join([
      'Found new Objective-C implementation file%(plural)s without compile'
      ' guard%(plural)s. Please use the following compile guard'
      ':' % {'plural': plural_suffix}
  ] + ARC_COMPILE_GUARD + files_without_headers) + '\n'
  return [output_api.PresubmitError(error_message)]
def _CheckARCCompilationGuard ( input_api , output_api ) : files_without_headers = [ ] for f in input_api . AffectedFiles ( ) : if f . Action ( ) != 'A' : continue _ , ext = os . path . splitext ( f . LocalPath ( ) ) if ext not in ( '.m' , '.mm' ) : continue if not IsSubListOf ( ARC_COMPILE_GUARD , f . NewContents ( ) ) : files_without_headers . append ( f . LocalPath ( ) ) if not files_without_headers : return [ ] plural_suffix = '' if len ( files_without_headers ) == 1 else 's' error_message = '\n' . join ( [ 'Found new Objective-C implementation file%(plural)s without compile' ' guard%(plural)s. Please use the following compile guard' ':' % { 'plural' : plural_suffix } ] + ARC_COMPILE_GUARD + files_without_headers ) + '\n' return [ output_api . PresubmitError ( error_message ) ]
Checks whether new objc files have proper ARC compile guards.
Checks whether new objc files have proper ARC compile guards .
""" Checks whether new objc files have proper ARC compile guards."""
input_api
output_api