Classes | Functions | Variables
cpplint Namespace Reference

Classes

class  CleansedLines

Functions

def CheckForBadCharacters
def CheckForCopyright
def CheckForHeaderGuard
def CheckForMultilineCommentsAndStrings
def CheckForNewlineAtEOF
def CleanseComments
def CleanseRawStrings
def CloseExpression
def FindEndOfExpressionInLine
def FindNextMultiLineCommentEnd
def FindNextMultiLineCommentStart
def FindStartOfExpressionInLine
def GetHeaderGuardCPPVariable
def RemoveMultiLineComments
def RemoveMultiLineCommentsFromRange
def ReverseCloseExpression

Variables

dictionary _ALT_TOKEN_REPLACEMENT
tuple _ALT_TOKEN_REPLACEMENT_PATTERN
list _CHECK_MACROS
tuple _CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS])
tuple _CPP_HEADERS
list _DEFAULT_FILTERS = ['-build/include_alpha']
list _ERROR_CATEGORIES
string _USAGE

Function Documentation

def cpplint.CheckForBadCharacters (   filename,
  lines,
  error 
)
Logs an error for each line containing bad characters.

Two kinds of bad characters:

1. Unicode replacement characters: These indicate that either the file
contained invalid UTF-8 (likely) or Unicode replacement characters (which
it shouldn't).  Note that it's possible for this to throw off line
numbering if the invalid UTF-8 occurred adjacent to a newline.

2. NUL bytes.  These are problematic for some tools.

Args:
  filename: The name of the current file.
  lines: An array of strings, each representing a line of the file.
  error: The function to call with any errors found.

Definition at line 1476 of file cpplint.py.

def cpplint.CheckForCopyright (   filename,
  lines,
  error 
)
Logs an error if no Copyright message appears at the top of the file.

Definition at line 1364 of file cpplint.py.

def cpplint.CheckForHeaderGuard (   filename,
  lines,
  error 
)
Checks that the file contains a header guard.

Logs an error if no #ifndef header guard is present.  For other
headers, checks that the full pathname is used.

Args:
  filename: The name of the C++ header file.
  lines: An array of strings, each representing a line of the file.
  error: The function to call with any errors found.

Definition at line 1401 of file cpplint.py.

def cpplint.CheckForMultilineCommentsAndStrings (   filename,
  clean_lines,
  linenum,
  error 
)
Logs an error if we see /* ... */ or "..." that extend past one line.

/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other.  Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backslash)
terminates each line. Although not currently prohibited by the C++
style guide, it's ugly and unnecessary. We don't do well with either
in this lint program, so we warn about both.

Args:
  filename: The name of the current file.
  clean_lines: A CleansedLines instance containing the file.
  linenum: The number of the line to check.
  error: The function to call with any errors found.

Definition at line 1519 of file cpplint.py.

def cpplint.CheckForNewlineAtEOF (   filename,
  lines,
  error 
)
Logs an error if there is no newline char at the end of the file.

Args:
  filename: The name of the current file.
  lines: An array of strings, each representing a line of the file.
  error: The function to call with any errors found.

Definition at line 1501 of file cpplint.py.

def cpplint.CleanseComments (   line)
Removes //-comments and single-line C-style /* */ comments.

Args:
  line: A line of C++ source.

Returns:
  The line with single-line comments removed.

Definition at line 1159 of file cpplint.py.

def cpplint.CleanseRawStrings (   raw_lines)
Removes C++11 raw strings from lines.

  Before:
    static const char kData[] = R"(
        multi-line string
        )";

  After:
    static const char kData[] = ""
        (replaced by blank line)
        "";

Args:
  raw_lines: list of raw lines.

Returns:
  list of lines with C++11 raw strings replaced by empty strings.

Definition at line 1054 of file cpplint.py.

def cpplint.CloseExpression (   clean_lines,
  linenum,
  pos 
)
If input points to ( or { or [ or <, finds the position that closes it.

If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.

Args:
  clean_lines: A CleansedLines instance containing the file.
  linenum: The number of the line to check.
  pos: A position on the line.

Returns:
  A tuple (line, linenum, pos) pointer *past* the closing brace, or
  (line, len(lines), -1) if we never find a close.  Note we ignore
  strings and comments when matching; and the line we return is the
  'cleansed' line at linenum.

Definition at line 1246 of file cpplint.py.

def cpplint.FindEndOfExpressionInLine (   line,
  startpos,
  depth,
  startchar,
  endchar 
)
Find the position just after the matching endchar.

Args:
  line: a CleansedLines line.
  startpos: start searching at this position.
  depth: nesting level at startpos.
  startchar: expression opening character.
  endchar: expression closing character.

Returns:
  On finding matching endchar: (index just after matching endchar, 0)
  Otherwise: (-1, new depth at end of this line)

Definition at line 1222 of file cpplint.py.

def cpplint.FindNextMultiLineCommentEnd (   lines,
  lineix 
)
We are inside a comment, find the end marker.

Definition at line 1126 of file cpplint.py.

def cpplint.FindNextMultiLineCommentStart (   lines,
  lineix 
)
Find the beginning marker for a multiline comment.

Definition at line 1115 of file cpplint.py.

def cpplint.FindStartOfExpressionInLine (   line,
  endpos,
  depth,
  startchar,
  endchar 
)
Find position at the matching startchar.

This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.

Args:
  line: a CleansedLines line.
  endpos: start searching at this position.
  depth: nesting level at endpos.
  startchar: expression opening character.
  endchar: expression closing character.

Returns:
  On finding matching startchar: (index at matching startchar, 0)
  Otherwise: (-1, new depth at beginning of this line)

Definition at line 1292 of file cpplint.py.

Returns the CPP variable that should be used as a header guard.

Args:
  filename: The name of a C++ header file.

Returns:
  The CPP variable that should be used as a header guard in the
  named file.

Definition at line 1377 of file cpplint.py.

def cpplint.RemoveMultiLineComments (   filename,
  lines,
  error 
)
Removes multiline (c-style) comments from lines.

Definition at line 1143 of file cpplint.py.

def cpplint.RemoveMultiLineCommentsFromRange (   lines,
  begin,
  end 
)
Clears a range of lines for multi-line comments.

Definition at line 1135 of file cpplint.py.

def cpplint.ReverseCloseExpression (   clean_lines,
  linenum,
  pos 
)
If input points to ) or } or ] or >, finds the position that opens it.

If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.

Args:
  clean_lines: A CleansedLines instance containing the file.
  linenum: The number of the line to check.
  pos: A position on the line.

Returns:
  A tuple (line, linenum, pos) pointer *at* the opening brace, or
  (line, 0, -1) if we never find the matching opening brace.  Note
  we ignore strings and comments when matching; and the line we
  return is the 'cleansed' line at linenum.

Definition at line 1319 of file cpplint.py.


Variable Documentation

Initial value:
00001 {
00002     'and': '&&',
00003     'bitor': '|',
00004     'or': '||',
00005     'xor': '^',
00006     'compl': '~',
00007     'bitand': '&',
00008     'and_eq': '&=',
00009     'or_eq': '|=',
00010     'xor_eq': '^=',
00011     'not': '!',
00012     'not_eq': '!='
00013     }

Definition at line 394 of file cpplint.py.

Definition at line 413 of file cpplint.py.

Initial value:
00001 [
00002     'DCHECK', 'CHECK',
00003     'EXPECT_TRUE_M', 'EXPECT_TRUE',
00004     'ASSERT_TRUE_M', 'ASSERT_TRUE',
00005     'EXPECT_FALSE_M', 'EXPECT_FALSE',
00006     'ASSERT_FALSE_M', 'ASSERT_FALSE',
00007     ]

Definition at line 360 of file cpplint.py.

tuple cpplint::_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS])

Definition at line 369 of file cpplint.py.

Definition at line 222 of file cpplint.py.

list cpplint::_DEFAULT_FILTERS = ['-build/include_alpha']

Definition at line 214 of file cpplint.py.

Definition at line 146 of file cpplint.py.

Definition at line 60 of file cpplint.py.



acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:01:40