Classes | |
class | CleansedLines |
Functions | |
def | CheckForBadCharacters |
def | CheckForCopyright |
def | CheckForHeaderGuard |
def | CheckForMultilineCommentsAndStrings |
def | CheckForNewlineAtEOF |
def | CheckHeaderFileIncluded |
def | CleanseComments |
def | CleanseRawStrings |
def | CloseExpression |
def | FindEndOfExpressionInLine |
def | FindNextMultiLineCommentEnd |
def | FindNextMultiLineCommentStart |
def | FindStartOfExpressionInLine |
def | GetHeaderGuardCPPVariable |
def | GetIndentLevel |
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 |
list | _LEGACY_ERROR_CATEGORIES |
tuple | _THIRD_PARTY_HEADERS_PATTERN |
string | _UNSAFE_FUNC_PREFIX = r'(?:[-+*/=%^&|(<]\s*|>\s+)' |
string | _USAGE |
def roslint.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 1800 of file cpplint.py.
def roslint.cpplint.CheckForCopyright | ( | filename, | |
lines, | |||
error | |||
) |
Logs an error if no Copyright message appears at the top of the file.
Definition at line 1622 of file cpplint.py.
def roslint.cpplint.CheckForHeaderGuard | ( | filename, | |
clean_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. clean_lines: A CleansedLines instance containing the file. error: The function to call with any errors found.
Definition at line 1677 of file cpplint.py.
def roslint.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 1843 of file cpplint.py.
def roslint.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 1825 of file cpplint.py.
def roslint.cpplint.CheckHeaderFileIncluded | ( | filename, | |
include_state, | |||
error | |||
) |
Logs an error if a .cc file does not include its header.
Definition at line 1775 of file cpplint.py.
def roslint.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 1274 of file cpplint.py.
def roslint.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 1164 of file cpplint.py.
def roslint.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. TODO(unknown): cpplint spends a fair bit of time matching parentheses. Ideally we would want to index all opening and closing parentheses once and have CloseExpression be just a simple lookup, but due to preprocessor tricks, this is not so easy. 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 1463 of file cpplint.py.
def roslint.cpplint.FindEndOfExpressionInLine | ( | line, | |
startpos, | |||
stack | |||
) |
Find the position just after the end of current parenthesized expression. Args: line: a CleansedLines line. startpos: start searching at this position. stack: nesting stack at startpos. Returns: On finding matching end: (index just after matching end, None) On finding an unclosed expression: (-1, None) Otherwise: (-1, new stack at end of this line)
Definition at line 1385 of file cpplint.py.
def roslint.cpplint.FindNextMultiLineCommentEnd | ( | lines, | |
lineix | |||
) |
We are inside a comment, find the end marker.
Definition at line 1241 of file cpplint.py.
def roslint.cpplint.FindNextMultiLineCommentStart | ( | lines, | |
lineix | |||
) |
Find the beginning marker for a multiline comment.
Definition at line 1230 of file cpplint.py.
def roslint.cpplint.FindStartOfExpressionInLine | ( | line, | |
endpos, | |||
stack | |||
) |
Find position at the matching start of current expression. 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. stack: nesting stack at endpos. Returns: On finding matching start: (index at matching start, None) On finding an unclosed expression: (-1, None) Otherwise: (-1, new stack at beginning of this line)
Definition at line 1507 of file cpplint.py.
def roslint.cpplint.GetHeaderGuardCPPVariable | ( | filename | ) |
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 1651 of file cpplint.py.
def roslint.cpplint.GetIndentLevel | ( | line | ) |
Return the number of leading spaces in line. Args: line: A string to check. Returns: An integer count of leading spaces, possibly zero.
Definition at line 1635 of file cpplint.py.
def roslint.cpplint.RemoveMultiLineComments | ( | filename, | |
lines, | |||
error | |||
) |
Removes multiline (c-style) comments from lines.
Definition at line 1258 of file cpplint.py.
def roslint.cpplint.RemoveMultiLineCommentsFromRange | ( | lines, | |
begin, | |||
end | |||
) |
Clears a range of lines for multi-line comments.
Definition at line 1250 of file cpplint.py.
def roslint.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 1584 of file cpplint.py.
dictionary roslint::cpplint::_ALT_TOKEN_REPLACEMENT |
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 443 of file cpplint.py.
Definition at line 462 of file cpplint.py.
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 409 of file cpplint.py.
tuple roslint::cpplint::_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS]) |
Definition at line 418 of file cpplint.py.
Definition at line 261 of file cpplint.py.
list roslint::cpplint::_DEFAULT_FILTERS = ['-build/include_alpha'] |
Definition at line 254 of file cpplint.py.
Definition at line 177 of file cpplint.py.
00001 [ 00002 'readability/streams', 00003 ]
Definition at line 246 of file cpplint.py.
00001 re.compile( 00002 r'^(?:[^/]*[A-Z][^/]*\.h|lua\.h|lauxlib\.h|lualib\.h)$')
Definition at line 402 of file cpplint.py.
string roslint::cpplint::_UNSAFE_FUNC_PREFIX = r'(?:[-+*/=%^&|(<]\s*|>\s+)' |
Definition at line 1893 of file cpplint.py.
string roslint::cpplint::_USAGE |
Definition at line 56 of file cpplint.py.