def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,<EOL>error):
<EOL>raw_lines = clean_lines.lines_without_raw_strings<EOL>line = raw_lines[linenum]<EOL>prev = raw_lines[linenum - <NUM_LIT:1>] if linenum > <NUM_LIT:0> else '<STR_LIT>'<EOL>if line.find('<STR_LIT:\t>') != -<NUM_LIT:1>:<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:1>,<EOL>'<STR_LIT>')<EOL><DEDENT>scope_or_label_pattern = r'<STR_LIT>'<EOL>classinfo = nesting_state.InnermostClass()<EOL>initial_spaces = <NUM_LIT:0><EOL>cleansed_line = clean_lines.elided[linenum]<EOL>while initial_spaces < len(line) and line[initial_spaces] == '<STR_LIT:U+0020>':<EOL><INDENT>initial_spaces += <NUM_LIT:1><EOL><DEDENT>if (not Search(r'<STR_LIT>', prev) and<EOL>(initial_spaces == <NUM_LIT:1> or initial_spaces == <NUM_LIT:3>) and<EOL>not Match(scope_or_label_pattern, cleansed_line) and<EOL>not (clean_lines.raw_lines[linenum] != line and<EOL>Match(r'<STR_LIT>', line))):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:3>,<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if line and line[-<NUM_LIT:1>].isspace():<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:4>,<EOL>'<STR_LIT>')<EOL><DEDENT>is_header_guard = False<EOL>if file_extension in GetHeaderExtensions():<EOL><INDENT>cppvar = GetHeaderGuardCPPVariable(filename)<EOL>if (line.startswith('<STR_LIT>' % cppvar) or<EOL>line.startswith('<STR_LIT>' % cppvar) or<EOL>line.startswith('<STR_LIT>' % cppvar)):<EOL><INDENT>is_header_guard = True<EOL><DEDENT><DEDENT>if (not line.startswith('<STR_LIT>') and not is_header_guard and<EOL>not Match(r'<STR_LIT>', line) and<EOL>not Match(r'<STR_LIT>', line) and<EOL>not Match(r'<STR_LIT>', line) and<EOL>not Match(r'<STR_LIT>', line)):<EOL><INDENT>line_width = GetLineWidth(line)<EOL>if line_width > _line_length:<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:2>,<EOL>'<STR_LIT>' % _line_length)<EOL><DEDENT><DEDENT>if (cleansed_line.count('<STR_LIT:;>') > <NUM_LIT:1> and<EOL>not Match(r'<STR_LIT>',<EOL>line) and<EOL>cleansed_line.find('<STR_LIT>') == -<NUM_LIT:1> and<EOL>(GetPreviousNonBlankLine(clean_lines, linenum)[<NUM_LIT:0>].find('<STR_LIT>') == -<NUM_LIT:1> or<EOL>GetPreviousNonBlankLine(clean_lines, linenum)[<NUM_LIT:0>].find('<STR_LIT:;>') != -<NUM_LIT:1>) and<EOL>not ((cleansed_line.find('<STR_LIT>') != -<NUM_LIT:1> or<EOL>cleansed_line.find('<STR_LIT>') != -<NUM_LIT:1>) and<EOL>cleansed_line.find('<STR_LIT>') != -<NUM_LIT:1>)):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:0>,<EOL>'<STR_LIT>')<EOL><DEDENT>CheckBraces(filename, clean_lines, linenum, error)<EOL>CheckTrailingSemicolon(filename, clean_lines, linenum, error)<EOL>CheckEmptyBlockBody(filename, clean_lines, linenum, error)<EOL>CheckAccess(filename, clean_lines, linenum, nesting_state, error)<EOL>CheckSpacing(filename, clean_lines, linenum, nesting_state, error)<EOL>CheckOperatorSpacing(filename, clean_lines, linenum, error)<EOL>CheckParenthesisSpacing(filename, clean_lines, linenum, error)<EOL>CheckCommaSpacing(filename, clean_lines, linenum, error)<EOL>CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error)<EOL>CheckSpacingForFunctionCall(filename, clean_lines, linenum, error)<EOL>CheckCheck(filename, clean_lines, linenum, error)<EOL>CheckAltTokens(filename, clean_lines, linenum, error)<EOL>classinfo = nesting_state.InnermostClass()<EOL>if classinfo:<EOL><INDENT>CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)<EOL><DEDENT>
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.
      file_extension: The extension (without the dot) of the filename.
      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.