wpiformat/wpiformat/cpplint.py
def CheckStyle(filename, clean_lines, linenum, is_header, nesting_state,
               error):
  """Checks rules from the 'C++ style rules' section of cppguide.html.

  Most of these rules are hard to test (naming, comment style), but we
  do what we can.  In particular we check for 2-space indents, line lengths,
  tab usage, spaces inside code, etc.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    is_header: Whether file is header.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    error: The function to call with any errors found.
  """

  # Don't use "elided" lines here, otherwise we can't check commented lines.
  # Don't want to use "raw" either, because we don't want to check inside C++11
  # raw strings,
  raw_lines = clean_lines.lines_without_raw_strings
  line = raw_lines[linenum]
  prev = raw_lines[linenum - 1] if linenum > 0 else ''

  # One or three blank spaces at the beginning of the line is weird; it's
  # hard to reconcile that with 2-space indents.
  # NOTE: here are the conditions rob pike used for his tests.  Mine aren't
  # as sophisticated, but it may be worth becoming so:  RLENGTH==initial_spaces
  # if(RLENGTH > 20) complain = 0;
  # if(match($0, " +(error|private|public|protected):")) complain = 0;
  # if(match(prev, "&& *$")) complain = 0;
  # if(match(prev, "\\|\\| *$")) complain = 0;
  # if(match(prev, "[\",=><] *$")) complain = 0;
  # if(match($0, " <<")) complain = 0;
  # if(match(prev, " +for \\(")) complain = 0;
  # if(prevodd && match(prevprev, " +for \\(")) complain = 0;
  classinfo = nesting_state.InnermostClass()
  cleansed_line = clean_lines.elided[linenum]

  # Some more style checks
  CheckBraces(filename, clean_lines, linenum, error)
  CheckTrailingSemicolon(filename, clean_lines, linenum, error)
  CheckEmptyBlockBody(filename, clean_lines, linenum, error)
  CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
  CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error)
  CheckAltTokens(filename, clean_lines, linenum, error)
  classinfo = nesting_state.InnermostClass()
  if classinfo:
    CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
Checks rules from the 'C++ style rules' section of cppguide.html.

  Most of these rules are hard to test (naming, comment style), but we
  do what we can.  In particular we check for 2-space indents, line lengths,
  tab usage, spaces inside code, etc.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    is_header: Whether file is header.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    error: The function to call with any errors found.
  
Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can.  In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Checks rules from the ' C ++ style rules ' section of cppguide . html . Most of these rules are hard to test ( naming comment style ) but we do what we can . In particular we check for 2 - space indents line lengths tab usage spaces inside code etc .
def CheckStyle(filename, clean_lines, linenum, is_header, nesting_state,
               error):
  raw_lines = clean_lines.lines_without_raw_strings
  line = raw_lines[linenum]
  prev = raw_lines[linenum - 1] if linenum > 0 else ''
  classinfo = nesting_state.InnermostClass()
  cleansed_line = clean_lines.elided[linenum]
  CheckBraces(filename, clean_lines, linenum, error)
  CheckTrailingSemicolon(filename, clean_lines, linenum, error)
  CheckEmptyBlockBody(filename, clean_lines, linenum, error)
  CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
  CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error)
  CheckAltTokens(filename, clean_lines, linenum, error)
  classinfo = nesting_state.InnermostClass()
  if classinfo:
    CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
def CheckStyle ( filename , clean_lines , linenum , is_header , nesting_state , error ) : raw_lines = clean_lines . lines_without_raw_strings line = raw_lines [ linenum ] prev = raw_lines [ linenum - 1 ] if linenum > 0 else '' classinfo = nesting_state . InnermostClass ( ) cleansed_line = clean_lines . elided [ linenum ] CheckBraces ( filename , clean_lines , linenum , error ) CheckTrailingSemicolon ( filename , clean_lines , linenum , error ) CheckEmptyBlockBody ( filename , clean_lines , linenum , error ) CheckSpacing ( filename , clean_lines , linenum , nesting_state , error ) CheckBracesSpacing ( filename , clean_lines , linenum , nesting_state , error ) CheckAltTokens ( filename , clean_lines , linenum , error ) classinfo = nesting_state . InnermostClass ( ) if classinfo : CheckSectionSpacing ( filename , clean_lines , classinfo , linenum , error )
Checks rules from the 'C++ style rules' section of cppguide.html.
Checks rules from the ' C ++ style rules ' section of cppguide . html .
"""Checks rules from the 'C++ style rules' section of cppguide.html.

  Most of these rules are hard to test (naming, comment style), but we
  do what we can.  In particular we check for 2-space indents, line lengths,
  tab usage, spaces inside code, etc.

  Args:
    filename: The name of the current file.
    clean_lines: A CleansedLines instance containing the file.
    linenum: The number of the line to check.
    is_header: Whether file is header.
    nesting_state: A NestingState instance which maintains information about
                   the current stack of nested blocks being parsed.
    error: The function to call with any errors found.
  """ # Don't use "elided" lines here, otherwise we can't check commented lines. # Don't want to use "raw" either, because we don't want to check inside C++11 # raw strings, # One or three blank spaces at the beginning of the line is weird; it's # hard to reconcile that with 2-space indents. # NOTE: here are the conditions rob pike used for his tests.  Mine aren't # as sophisticated, but it may be worth becoming so:  RLENGTH==initial_spaces # if(RLENGTH > 20) complain = 0; # if(match($0, " +(error|private|public|protected):")) complain = 0; # if(match(prev, "&& *$")) complain = 0; # if(match(prev, "\\|\\| *$")) complain = 0; # if(match(prev, "[\",=><] *$")) complain = 0; # if(match($0, " <<")) complain = 0; # if(match(prev, " +for \\(")) complain = 0; # if(prevodd && match(prevprev, " +for \\(")) complain = 0; # Some more style checks
filename
The name of the current file.
The name of the current file .
clean_lines
A CleansedLines instance containing the file.
A CleansedLines instance containing the file .
linenum
The number of the line to check.
The number of the line to check .
is_header
Whether file is header.
Whether file is header .
nesting_state
A NestingState instance which maintains information about
the current stack of nested blocks being parsed.
A NestingState instance which maintains information about the current stack of nested blocks being parsed .
error
The function to call with any errors found.
The function to call with any errors found .