parameters: (self, last_token, state)
docstring: Checks whether the line is too long.
  
      Args:
        last_token: The last token in the line.
docstring_summary: Checks whether the line is too long.
docstring_tokens: Checks whether the line is too long .
function: def _CheckLineLength(self, last_token, state):
      """Checks whether the line is too long.
  
      Args:
        last_token: The last token in the line.
      """
      # Start from the last token so that we have the flag object attached to
      # and DOC_FLAG tokens.
      line_number = last_token.line_number
      token = last_token
  
      # Build a representation of the string where spaces indicate potential
      # line-break locations.
      line = []
      while token and token.line_number == line_number:
        if state.IsTypeToken(token):
          line.insert(0, 'x' * len(token.string))
        elif token.type in (Type.IDENTIFIER, Type.NORMAL):
          # Dots are acceptable places to wrap.
          line.insert(0, token.string.replace('.', ' '))
        else:
          line.insert(0, token.string)
        token = token.previous
  
      line = ''.join(line)
      line = line.rstrip('\n\r\f')
      try:
        length = len(unicode(line, 'utf-8'))
      except:
        # Unknown encoding. The line length may be wrong, as was originally the
        # case for utf-8 (see bug 1735846). For now just accept the default
        # length, but as we find problems we can either add test for other
        # possible encodings or return without an error to protect against
        # false positives at the cost of more false negatives.
        length = len(line)
  
      if length > self.MAX_LINE_LENGTH:
  
        # If the line matches one of the exceptions, then it's ok.
        for long_line_regexp in self.GetLongLineExceptions():
          if long_line_regexp.match(last_token.line):
            return
  
        # If the line consists of only one "word", or multiple words but all
        # except one are ignoreable, then it's ok.
        parts = set(line.split())
  
        # We allow two "words" (type and name) when the line contains @param
        max = 1
        if '@param' in parts:
          max = 2
  
        # Custom tags like @requires may have url like descriptions, so ignore
        # the tag, similar to how we handle @see.
        custom_tags = set(['@%s' % f for f in FLAGS.custom_jsdoc_tags])
        if (len(parts.difference(self.LONG_LINE_IGNORE | custom_tags)) > max):
          self._HandleError(errors.LINE_TOO_LONG,
              'Line too long (%d characters).' % len(line), last_token)
function_tokens: def _CheckLineLength ( self , last_token , state ) : # Start from the last token so that we have the flag object attached to # and DOC_FLAG tokens. line_number = last_token . line_number token = last_token # Build a representation of the string where spaces indicate potential # line-break locations. line = [ ] while token and token . line_number == line_number : if state . IsTypeToken ( token ) : line . insert ( 0 , 'x' * len ( token . string ) ) elif token . type in ( Type . IDENTIFIER , Type . NORMAL ) : # Dots are acceptable places to wrap. line . insert ( 0 , token . string . replace ( '.' , ' ' ) ) else : line . insert ( 0 , token . string ) token = token . previous line = '' . join ( line ) line = line . rstrip ( '\n\r\f' ) try : length = len ( unicode ( line , 'utf-8' ) ) except : # Unknown encoding. The line length may be wrong, as was originally the # case for utf-8 (see bug 1735846). For now just accept the default # length, but as we find problems we can either add test for other # possible encodings or return without an error to protect against # false positives at the cost of more false negatives. length = len ( line ) if length > self . MAX_LINE_LENGTH : # If the line matches one of the exceptions, then it's ok. for long_line_regexp in self . GetLongLineExceptions ( ) : if long_line_regexp . match ( last_token . line ) : return # If the line consists of only one "word", or multiple words but all # except one are ignoreable, then it's ok. parts = set ( line . split ( ) ) # We allow two "words" (type and name) when the line contains @param max = 1 if '@param' in parts : max = 2 # Custom tags like @requires may have url like descriptions, so ignore # the tag, similar to how we handle @see. custom_tags = set ( [ '@%s' % f for f in FLAGS . custom_jsdoc_tags ] ) if ( len ( parts . difference ( self . LONG_LINE_IGNORE | custom_tags ) ) > max ) : self . _HandleError ( errors . LINE_TOO_LONG , 'Line too long (%d characters).' % len ( line ) , last_token )