lib/webrtc-8d2248ff/PRESUBMIT.py
def _CheckJSONParseErrors(input_api, output_api):
  """Check that JSON files do not contain syntax errors."""

  def FilterFile(affected_file):
    return input_api.os_path.splitext(affected_file.LocalPath())[1] == '.json'

  def GetJSONParseError(input_api, filename):
    try:
      contents = input_api.ReadFile(filename)
      input_api.json.loads(contents)
    except ValueError as e:
      return e
    return None

  results = []
  for affected_file in input_api.AffectedFiles(
      file_filter=FilterFile, include_deletes=False):
    parse_error = GetJSONParseError(input_api,
                                    affected_file.AbsoluteLocalPath())
    if parse_error:
      results.append(output_api.PresubmitError('%s could not be parsed: %s' %
          (affected_file.LocalPath(), parse_error)))
  return results
Check that JSON files do not contain syntax errors.
Check that JSON files do not contain syntax errors.
Check that JSON files do not contain syntax errors .
def _CheckJSONParseErrors(input_api, output_api):
  def FilterFile(affected_file):
    return input_api.os_path.splitext(affected_file.LocalPath())[1] == '.json'
  def GetJSONParseError(input_api, filename):
    try:
      contents = input_api.ReadFile(filename)
      input_api.json.loads(contents)
    except ValueError as e:
      return e
    return None
  results = []
  for affected_file in input_api.AffectedFiles(
      file_filter=FilterFile, include_deletes=False):
    parse_error = GetJSONParseError(input_api,
                                    affected_file.AbsoluteLocalPath())
    if parse_error:
      results.append(output_api.PresubmitError('%s could not be parsed: %s' %
          (affected_file.LocalPath(), parse_error)))
  return results
def _CheckJSONParseErrors ( input_api , output_api ) : def FilterFile ( affected_file ) : return input_api . os_path . splitext ( affected_file . LocalPath ( ) ) [ 1 ] == '.json' def GetJSONParseError ( input_api , filename ) : try : contents = input_api . ReadFile ( filename ) input_api . json . loads ( contents ) except ValueError as e : return e return None results = [ ] for affected_file in input_api . AffectedFiles ( file_filter = FilterFile , include_deletes = False ) : parse_error = GetJSONParseError ( input_api , affected_file . AbsoluteLocalPath ( ) ) if parse_error : results . append ( output_api . PresubmitError ( '%s could not be parsed: %s' % ( affected_file . LocalPath ( ) , parse_error ) ) ) return results
Check that JSON files do not contain syntax errors.
Check that JSON files do not contain syntax errors .
"""Check that JSON files do not contain syntax errors."""
input_api
output_api