parameters: (filename, vlevel)
docstring: Does google-lint on a single file.
  
    Args:
      filename: The name of the file to parse.
  
      vlevel: The level of errors to report.  Every error of confidence
      >= verbose_level will be reported.  0 is a good default.
docstring_summary: Does google-lint on a single file.
docstring_tokens: Does google - lint on a single file .
function: def ProcessFile(filename, vlevel):
    """Does google-lint on a single file.
  
    Args:
      filename: The name of the file to parse.
  
      vlevel: The level of errors to report.  Every error of confidence
      >= verbose_level will be reported.  0 is a good default.
    """
  
    _SetVerboseLevel(vlevel)
  
    try:
      # Support the UNIX convention of using "-" for stdin.  Note that
      # we are not opening the file with universal newline support
      # (which codecs doesn't support anyway), so the resulting lines do
      # contain trailing '\r' characters if we are reading a file that
      # has CRLF endings.
      # If after the split a trailing '\r' is present, it is removed
      # below. If it is not expected to be present (i.e. os.linesep !=
      # '\r\n' as in Windows), a warning is issued below if this file
      # is processed.
  
      if filename == '-':
        lines = codecs.StreamReaderWriter(sys.stdin,
                                          codecs.getreader('utf8'),
                                          codecs.getwriter('utf8'),
                                          'replace').read().split('\n')
      else:
        lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n')
  
      carriage_return_found = False
      # Remove trailing '\r'.
      for linenum in range(len(lines)):
        if lines[linenum].endswith('\r'):
          lines[linenum] = lines[linenum].rstrip('\r')
          carriage_return_found = True
  
    except IOError:
      sys.stderr.write(
          "Skipping input '%s': Can't open for reading\n" % filename)
      return
  
    # Note, if no dot is found, this will give the entire filename as the ext.
    file_extension = filename[filename.rfind('.') + 1:]
  
    # When reading from stdin, the extension is unknown, so no cpplint tests
    # should rely on the extension.
    if (filename != '-' and file_extension != 'cc' and file_extension != 'h'
        and file_extension != 'cpp'):
      sys.stderr.write('Ignoring %s; not a .cc or .h file\n' % filename)
    else:
      ProcessFileData(filename, file_extension, lines, Error)
      if carriage_return_found and os.linesep != '\r\n':
        # Use 0 for linenum since outputing only one error for potentially
        # several lines.
        Error(filename, 0, 'whitespace/newline', 1,
              'One or more unexpected \\r (^M) found;'
              'better to use only a \\n')
  
    sys.stderr.write('Done processing %s\n' % filename)
function_tokens: def ProcessFile ( filename , vlevel ) : _SetVerboseLevel ( vlevel ) try : # Support the UNIX convention of using "-" for stdin.  Note that # we are not opening the file with universal newline support # (which codecs doesn't support anyway), so the resulting lines do # contain trailing '\r' characters if we are reading a file that # has CRLF endings. # If after the split a trailing '\r' is present, it is removed # below. If it is not expected to be present (i.e. os.linesep != # '\r\n' as in Windows), a warning is issued below if this file # is processed. if filename == '-' : lines = codecs . StreamReaderWriter ( sys . stdin , codecs . getreader ( 'utf8' ) , codecs . getwriter ( 'utf8' ) , 'replace' ) . read ( ) . split ( '\n' ) else : lines = codecs . open ( filename , 'r' , 'utf8' , 'replace' ) . read ( ) . split ( '\n' ) carriage_return_found = False # Remove trailing '\r'. for linenum in range ( len ( lines ) ) : if lines [ linenum ] . endswith ( '\r' ) : lines [ linenum ] = lines [ linenum ] . rstrip ( '\r' ) carriage_return_found = True except IOError : sys . stderr . write ( "Skipping input '%s': Can't open for reading\n" % filename ) return # Note, if no dot is found, this will give the entire filename as the ext. file_extension = filename [ filename . rfind ( '.' ) + 1 : ] # When reading from stdin, the extension is unknown, so no cpplint tests # should rely on the extension. if ( filename != '-' and file_extension != 'cc' and file_extension != 'h' and file_extension != 'cpp' ) : sys . stderr . write ( 'Ignoring %s; not a .cc or .h file\n' % filename ) else : ProcessFileData ( filename , file_extension , lines , Error ) if carriage_return_found and os . linesep != '\r\n' : # Use 0 for linenum since outputing only one error for potentially # several lines. Error ( filename , 0 , 'whitespace/newline' , 1 , 'One or more unexpected \\r (^M) found;' 'better to use only a \\n' ) sys . stderr . write ( 'Done processing %s\n' % filename )