chrome/android/webapk/PRESUBMIT.py
def _CheckNoOverlappingFileNamesInResourceDirsRule(input_api, output_api):
  """
  Checks that if a file has been added to a res/ directory that its file name
  is unique to the res/ directory.
    res/values/dimens.xml and res/values-v17/dimens.xml -> OK
    res/values/dimens.xml and libs/common/res_splash/values/dimens.xml -> BAD
  """
  res_dir_file_names_map = {}
  for f in input_api.AffectedFiles():
    local_path = input_api.os_path.relpath(f.AbsoluteLocalPath(),
                                           input_api.PresubmitLocalPath())
    for res_dir_local_path in RES_DIR_LOCAL_PATHS:
      if local_path.startswith(res_dir_local_path):
        file_name = input_api.os_path.basename(local_path)
        res_dir_file_names_map.setdefault(res_dir_local_path, set()).add(
            file_name)
        break

  if len(res_dir_file_names_map) == 0:
    return []

  overlapping_file_names = set()
  for res_dir, file_names in res_dir_file_names_map.items():
    for other_res_dir, other_file_names in res_dir_file_names_map.items():
      if res_dir == other_res_dir:
        continue

      # Check for affected files with identical name in |other_res_dir|.
      overlapping_file_names |= (file_names & other_file_names)

      # Check for existing files with identical name in |other_res_dir|.
      overlapping_file_names.update(
          _FindFileNamesInDirectory(input_api, other_res_dir, file_names))

  if len(overlapping_file_names) > 0:
    error_msg = ('Resources in different top level res/ directories {} should '
                 'have different names:').format(RES_DIR_LOCAL_PATHS)
    return [output_api.PresubmitError(error_msg,
                                      items=list(overlapping_file_names))]
  return []

  Checks that if a file has been added to a res/ directory that its file name
  is unique to the res/ directory.
    res/values/dimens.xml and res/values-v17/dimens.xml -> OK
    res/values/dimens.xml and libs/common/res_splash/values/dimens.xml -> BAD
  
Checks that if a file has been added to a res/ directory that its file name
is unique to the res/ directory.
Checks that if a file has been added to a res / directory that its file name is unique to the res / directory .
def _CheckNoOverlappingFileNamesInResourceDirsRule(input_api, output_api):
  res_dir_file_names_map = {}
  for f in input_api.AffectedFiles():
    local_path = input_api.os_path.relpath(f.AbsoluteLocalPath(),
                                           input_api.PresubmitLocalPath())
    for res_dir_local_path in RES_DIR_LOCAL_PATHS:
      if local_path.startswith(res_dir_local_path):
        file_name = input_api.os_path.basename(local_path)
        res_dir_file_names_map.setdefault(res_dir_local_path, set()).add(
            file_name)
        break
  if len(res_dir_file_names_map) == 0:
    return []
  overlapping_file_names = set()
  for res_dir, file_names in res_dir_file_names_map.items():
    for other_res_dir, other_file_names in res_dir_file_names_map.items():
      if res_dir == other_res_dir:
        continue
      overlapping_file_names |= (file_names & other_file_names)
      overlapping_file_names.update(
          _FindFileNamesInDirectory(input_api, other_res_dir, file_names))
  if len(overlapping_file_names) > 0:
    error_msg = ('Resources in different top level res/ directories {} should '
                 'have different names:').format(RES_DIR_LOCAL_PATHS)
    return [output_api.PresubmitError(error_msg,
                                      items=list(overlapping_file_names))]
  return []
def _CheckNoOverlappingFileNamesInResourceDirsRule ( input_api , output_api ) : res_dir_file_names_map = { } for f in input_api . AffectedFiles ( ) : local_path = input_api . os_path . relpath ( f . AbsoluteLocalPath ( ) , input_api . PresubmitLocalPath ( ) ) for res_dir_local_path in RES_DIR_LOCAL_PATHS : if local_path . startswith ( res_dir_local_path ) : file_name = input_api . os_path . basename ( local_path ) res_dir_file_names_map . setdefault ( res_dir_local_path , set ( ) ) . add ( file_name ) break if len ( res_dir_file_names_map ) == 0 : return [ ] overlapping_file_names = set ( ) for res_dir , file_names in res_dir_file_names_map . items ( ) : for other_res_dir , other_file_names in res_dir_file_names_map . items ( ) : if res_dir == other_res_dir : continue overlapping_file_names |= ( file_names & other_file_names ) overlapping_file_names . update ( _FindFileNamesInDirectory ( input_api , other_res_dir , file_names ) ) if len ( overlapping_file_names ) > 0 : error_msg = ( 'Resources in different top level res/ directories {} should ' 'have different names:' ) . format ( RES_DIR_LOCAL_PATHS ) return [ output_api . PresubmitError ( error_msg , items = list ( overlapping_file_names ) ) ] return [ ]
Checks that if a file has been added to a res/ directory that its file name
is unique to the res/ directory.
Checks that if a file has been added to a res / directory that its file name is unique to the res / directory .
"""
  Checks that if a file has been added to a res/ directory that its file name
  is unique to the res/ directory.
    res/values/dimens.xml and res/values-v17/dimens.xml -> OK
    res/values/dimens.xml and libs/common/res_splash/values/dimens.xml -> BAD
  """ # Check for affected files with identical name in |other_res_dir|. # Check for existing files with identical name in |other_res_dir|.
input_api
output_api