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 |
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 1461 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 1349 of file cpplint.py.
def roslint.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 1386 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 1504 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 1486 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 1144 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 1039 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. 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 1231 of file cpplint.py.
def roslint.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 1207 of file cpplint.py.
def roslint.cpplint.FindNextMultiLineCommentEnd | ( | lines, | |
lineix | |||
) |
We are inside a comment, find the end marker.
Definition at line 1111 of file cpplint.py.
def roslint.cpplint.FindNextMultiLineCommentStart | ( | lines, | |
lineix | |||
) |
Find the beginning marker for a multiline comment.
Definition at line 1100 of file cpplint.py.
def roslint.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 1277 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 1362 of file cpplint.py.
def roslint.cpplint.RemoveMultiLineComments | ( | filename, | |
lines, | |||
error | |||
) |
Removes multiline (c-style) comments from lines.
Definition at line 1128 of file cpplint.py.
def roslint.cpplint.RemoveMultiLineCommentsFromRange | ( | lines, | |
begin, | |||
end | |||
) |
Clears a range of lines for multi-line comments.
Definition at line 1120 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 1304 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 383 of file cpplint.py.
Definition at line 402 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 349 of file cpplint.py.
tuple roslint::cpplint::_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS]) |
Definition at line 358 of file cpplint.py.
Definition at line 211 of file cpplint.py.
list roslint::cpplint::_DEFAULT_FILTERS = ['-build/include_alpha'] |
Definition at line 203 of file cpplint.py.
Definition at line 135 of file cpplint.py.
string roslint::cpplint::_USAGE |
Definition at line 56 of file cpplint.py.