tools/android/checkxmlstyle/checkxmlstyle.py
def _CheckXmlNamespacePrefixes(input_api, output_api):
  """Checks consistency of prefixes used for XML namespace names."""
  errors = []
  for f in IncludedFiles(input_api):
    for line_number, line in f.ChangedContents():
      xml_app_namespace = helpers.XML_APP_NAMESPACE_PATTERN.search(line)
      if xml_app_namespace and not xml_app_namespace.group(1) == 'app':
        errors.append(
            '  %s:%d\n    \t%s' % (f.LocalPath(), line_number, line.strip()))
  if errors:
    return [
        output_api.PresubmitError(
            '''
  XML Namespace Prefixes Check failed:
    Your new code added new xml namespace declaration that is not consistent
    with other XML files. Namespace "http://schemas.android.com/apk/res-auto"
    should use 'app' prefix:

    xmlns:app="http://schemas.android.com/apk/res-auto"

    See https://crbug.com/850616 for more information.
  ''', errors)
    ]
  return []
Checks consistency of prefixes used for XML namespace names.
Checks consistency of prefixes used for XML namespace names.
Checks consistency of prefixes used for XML namespace names .
def _CheckXmlNamespacePrefixes(input_api, output_api):
  errors = []
  for f in IncludedFiles(input_api):
    for line_number, line in f.ChangedContents():
      xml_app_namespace = helpers.XML_APP_NAMESPACE_PATTERN.search(line)
      if xml_app_namespace and not xml_app_namespace.group(1) == 'app':
        errors.append(
            '  %s:%d\n    \t%s' % (f.LocalPath(), line_number, line.strip()))
  if errors:
    return [
        output_api.PresubmitError(
            '''
  XML Namespace Prefixes Check failed:
    Your new code added new xml namespace declaration that is not consistent
    with other XML files. Namespace "http://schemas.android.com/apk/res-auto"
    should use 'app' prefix:
    xmlns:app="http://schemas.android.com/apk/res-auto"
    See https://crbug.com/850616 for more information.
  ''', errors)
    ]
  return []
def _CheckXmlNamespacePrefixes ( input_api , output_api ) : errors = [ ] for f in IncludedFiles ( input_api ) : for line_number , line in f . ChangedContents ( ) : xml_app_namespace = helpers . XML_APP_NAMESPACE_PATTERN . search ( line ) if xml_app_namespace and not xml_app_namespace . group ( 1 ) == 'app' : errors . append ( '  %s:%d\n    \t%s' % ( f . LocalPath ( ) , line_number , line . strip ( ) ) ) if errors : return [ output_api . PresubmitError ( '''
  XML Namespace Prefixes Check failed:
    Your new code added new xml namespace declaration that is not consistent
    with other XML files. Namespace "http://schemas.android.com/apk/res-auto"
    should use 'app' prefix:

    xmlns:app="http://schemas.android.com/apk/res-auto"

    See https://crbug.com/850616 for more information.
  ''' , errors ) ] return [ ]
Checks consistency of prefixes used for XML namespace names.
Checks consistency of prefixes used for XML namespace names .
"""Checks consistency of prefixes used for XML namespace names."""
input_api
output_api