wpiformat/wpiformat/cpplint.py
def CheckComment(line, filename, linenum, next_line_start, error):
  """Checks for common mistakes in comments.

  Args:
    line: The line in question.
    filename: The name of the current file.
    linenum: The number of the line to check.
    next_line_start: The first non-whitespace column of the next line.
    error: The function to call with any errors found.
  """
  commentpos = line.find('//')
  if commentpos != -1:
    # Check if the // may be in quotes.  If so, ignore it
    if regex.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0:
      # Checks for common mistakes in TODO comments.
      comment = line[commentpos:]
      match = _RE_PATTERN_TODO.match(comment)
      if match:
        # One whitespace is correct; zero whitespace is handled elsewhere.
        leading_whitespace = match.group(1)
        if len(leading_whitespace) > 1:
          error(filename, linenum, 'whitespace/todo', 2,
                'Too many spaces before TODO')

      # If the comment contains an alphanumeric character, there
      # should be a space somewhere between it and the // unless
      # it's a /// or //! Doxygen comment.
      if (Match(r'//[^ ]*\w', comment) and
          not Match(r'(///|//\!)(\s+|$)', comment)):
        error(filename, linenum, 'whitespace/comments', 4,
              'Should have a space between // and comment')
Checks for common mistakes in comments.

  Args:
    line: The line in question.
    filename: The name of the current file.
    linenum: The number of the line to check.
    next_line_start: The first non-whitespace column of the next line.
    error: The function to call with any errors found.
  
Checks for common mistakes in comments.
Checks for common mistakes in comments .
def CheckComment(line, filename, linenum, next_line_start, error):
  commentpos = line.find('//')
  if commentpos != -1:
    if regex.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0:
      comment = line[commentpos:]
      match = _RE_PATTERN_TODO.match(comment)
      if match:
        leading_whitespace = match.group(1)
        if len(leading_whitespace) > 1:
          error(filename, linenum, 'whitespace/todo', 2,
                'Too many spaces before TODO')
      if (Match(r'//[^ ]*\w', comment) and
          not Match(r'(///|//\!)(\s+|$)', comment)):
        error(filename, linenum, 'whitespace/comments', 4,
              'Should have a space between // and comment')
def CheckComment ( line , filename , linenum , next_line_start , error ) : commentpos = line . find ( '//' ) if commentpos != - 1 : if regex . sub ( r'\\.' , '' , line [ 0 : commentpos ] ) . count ( '"' ) % 2 == 0 : comment = line [ commentpos : ] match = _RE_PATTERN_TODO . match ( comment ) if match : leading_whitespace = match . group ( 1 ) if len ( leading_whitespace ) > 1 : error ( filename , linenum , 'whitespace/todo' , 2 , 'Too many spaces before TODO' ) if ( Match ( r'//[^ ]*\w' , comment ) and not Match ( r'(///|//\!)(\s+|$)' , comment ) ) : error ( filename , linenum , 'whitespace/comments' , 4 , 'Should have a space between // and comment' )
Checks for common mistakes in comments.
Checks for common mistakes in comments .
"""Checks for common mistakes in comments.

  Args:
    line: The line in question.
    filename: The name of the current file.
    linenum: The number of the line to check.
    next_line_start: The first non-whitespace column of the next line.
    error: The function to call with any errors found.
  """ # Check if the // may be in quotes.  If so, ignore it # Checks for common mistakes in TODO comments. # One whitespace is correct; zero whitespace is handled elsewhere. # If the comment contains an alphanumeric character, there # should be a space somewhere between it and the // unless # it's a /// or //! Doxygen comment.
line
The line in question.
The line in question .
filename
The name of the current file.
The name of the current file .
linenum
The number of the line to check.
The number of the line to check .
next_line_start
The first non-whitespace column of the next line.
The first non - whitespace column of the next line .
error
The function to call with any errors found.
The function to call with any errors found .