Lines Matching refs:line

41 same line, but it is far from perfect (in either direction).
70 'NOLINT(category)' comment to the line. NOLINT or NOLINT(*)
71 suppresses errors of all categories on that line.
125 This is the allowed line length for the project. The default value is
408 # False positives include C-style multi-line comments and multi-line strings
425 _END_ASM = 2 # Last line of inline assembly block
447 # The allowed line length of files.
458 Parses any NOLINT comments on the current line, updating the global
464 raw_line: str, the line of input text, with comments.
465 linenum: int, the number of the current line.
490 """Returns true if the specified error category is suppressed on this line.
497 linenum: int, the current line number.
540 """Tracks line numbers for includes, and the order in which includes appear.
543 filename and line number on which that file was included.
606 linenum: The number of the line to check.
615 # If previous line was a blank line, assume that the headers are
821 """Count line in current function body."""
831 linenum: The number of the line to check.
985 "cpplint(category)" comments on the offending line. These are
990 linenum: The number of the line containing the error.
1019 # Matches multi-line C++ comments.
1024 # end of the line. Otherwise, we try to remove spaces from the right side,
1034 def IsCppString(line):
1035 """Does line terminate so, that the next symbol is in string constant.
1037 This function does not consider single-line nor multi-line comments.
1040 line: is a partial line of code starting from the 0..n.
1043 True, if next character appended to 'line' is inside a
1047 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
1048 return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
1056 multi-line string
1061 (replaced by blank line)
1073 for line in raw_lines:
1076 end = line.find(delimiter)
1079 # line and resume copying the original lines, and also insert
1080 # a "" on the last line.
1081 leading_space = Match(r'^(\s*)\S', line)
1082 line = leading_space.group(1) + '""' + line[end + len(delimiter):]
1085 # Haven't found the end yet, append a blank line.
1086 line = ''
1091 matched = Match(r'^(.*)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line)
1097 # Raw string ended on same line
1098 line = (matched.group(1) + '""' +
1102 # Start of a multi-line raw string
1103 line = matched.group(1) + '""'
1105 lines_without_raw_strings.append(line)
1116 # Only return this marker if the comment goes beyond this line
1133 """Clears a range of lines for multi-line comments."""
1135 # unnecessary blank line warnings later in the code.
1150 'Could not find end of multi-line comment')
1156 def CleanseComments(line):
1157 """Removes //-comments and single-line C-style /* */ comments.
1160 line: A line of C++ source.
1163 The line with single-line comments removed.
1165 commentpos = line.find('//')
1166 if commentpos != -1 and not IsCppString(line[:commentpos]):
1167 line = line[:commentpos].rstrip()
1169 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1199 """Collapses strings and chars on a line to simple "" or '' blocks.
1204 elided: The line being processed.
1207 The line with collapsed strings.
1219 def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
1223 line: a CleansedLines line.
1231 Otherwise: (-1, new depth at end of this line)
1233 for i in xrange(startpos, len(line)):
1234 if line[i] == startchar:
1236 elif line[i] == endchar:
1251 linenum: The number of the line to check.
1252 pos: A position on the line.
1255 A tuple (line, linenum, pos) pointer *past* the closing brace, or
1256 (line, len(lines), -1) if we never find a close. Note we ignore
1257 strings and comments when matching; and the line we return is the
1258 'cleansed' line at linenum.
1261 line = clean_lines.elided[linenum]
1262 startchar = line[pos]
1264 return (line, clean_lines.NumLines(), -1)
1270 # Check first line
1272 line, pos, 0, startchar, endchar)
1274 return (line, linenum, end_pos)
1279 line = clean_lines.elided[linenum]
1281 line, 0, num_open, startchar, endchar)
1283 return (line, linenum, end_pos)
1286 return (line, clean_lines.NumLines(), -1)
1289 def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
1296 line: a CleansedLines line.
1304 Otherwise: (-1, new depth at beginning of this line)
1307 if line[i] == endchar:
1309 elif line[i] == startchar:
1324 linenum: The number of the line to check.
1325 pos: A position on the line.
1328 A tuple (line, linenum, pos) pointer *at* the opening brace, or
1329 (line, 0, -1) if we never find the matching opening brace. Note
1330 we ignore strings and comments when matching; and the line we
1331 return is the 'cleansed' line at linenum.
1333 line = clean_lines.elided[linenum]
1334 endchar = line[pos]
1336 return (line, 0, -1)
1342 # Check last line
1344 line, pos, 0, startchar, endchar)
1346 return (line, linenum, start_pos)
1351 line = clean_lines.elided[linenum]
1353 line, len(line) - 1, num_open, startchar, endchar)
1355 return (line, linenum, start_pos)
1358 return (line, 0, -1)
1364 # We'll say it should occur by line 10. Don't forget there's a
1365 # dummy line at the front.
1366 for line in xrange(1, min(len(lines), 11)):
1367 if re.search(r'Copyright', lines[line], re.I): break
1368 else: # means no copyright line was found
1371 'You should have a line: "Copyright [year] <Copyright Owner>"')
1406 lines: An array of strings, each representing a line of the file.
1417 for linenum, line in enumerate(lines):
1418 linesplit = line.split()
1422 # set ifndef to the header guard presented on the #ifndef line.
1427 # find the last occurrence of #endif, save entire line
1428 if line.startswith('#endif'):
1429 endif = line
1470 '#endif line should be "#endif // %s"' % cppvar)
1474 """Logs an error for each line containing bad characters.
1480 it shouldn't). Note that it's possible for this to throw off line
1487 lines: An array of strings, each representing a line of the file.
1490 for linenum, line in enumerate(lines):
1491 if u'\ufffd' in line:
1494 if '\0' in line:
1503 lines: An array of strings, each representing a line of the file.
1517 """Logs an error if we see /* ... */ or "..." that extend past one line.
1519 /* ... */ comments are legit inside macros, for one line.
1522 lines, as long as a line continuation character (backslash)
1523 terminates each line. Although not currently prohibited by the C++
1530 linenum: The number of the line to check.
1533 line = clean_lines.elided[linenum]
1535 # Remove all \\ (escaped backslashes) from the line. They are OK, and the
1537 line = line.replace('\\\\', '')
1539 if line.count('/*') > line.count('*/'):
1541 'Complex multi-line /*...*/-style comment found. '
1545 'or with more clearly structured multi-line comments.')
1547 if (line.count('"') - line.count('\\"')) % 2:
1549 'Multi-line string ("...") found. This lint script doesn\'t '
1582 linenum: The number of the line to check.
1585 line = clean_lines.elided[linenum]
1587 ix = line.find(single_thread_function)
1589 if ix >= 0 and (ix == 0 or (not line[ix - 1].isalnum() and
1590 line[ix - 1] not in ('_', '.', '>'))):
1606 linenum: The number of the line to check.
1609 line = clean_lines.elided[linenum]
1610 if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line):
1635 linenum: The number of the line to check.
1638 line = clean_lines.elided[linenum]
1639 if _RE_PATTERN_INVALID_INCREMENT.match(line):
1662 linenum: The number of the line to check.
1675 linenum: The number of the line to check.
1712 line = clean_lines.elided[i]
1713 depth += line.count('{') - line.count('}')
1726 # This means we will not check single-line class definitions.
1747 line = clean_lines.raw_lines[linenum]
1761 and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
1780 line):
1786 if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
1837 def UpdatePreprocessor(self, line):
1856 line: current line to check.
1858 if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line):
1862 elif Match(r'^\s*#\s*(else|elif)\b', line):
1877 elif Match(r'^\s*#\s*endif\b', line):
1894 """Update nesting state with current line.
1899 linenum: The number of the line to check.
1902 line = clean_lines.elided[linenum]
1905 self.UpdatePreprocessor(line)
1911 depth_change = line.count('(') - line.count(')')
1918 _MATCH_ASM.match(line)):
1922 # Not entering assembly block. If previous line was _END_ASM,
1930 # Consume namespace declaration at the beginning of the line. Do
1931 # this in a loop so that we catch same line declarations like this:
1938 namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line)
1945 line = namespace_decl_match.group(2)
1946 if line.find('{') != -1:
1948 line = line[line.find('{') + 1:]
1950 # Look for a class declaration in whatever is left of the line
1974 r'(([^=>]|<[^<>]*>|<[^<>]*<[^<>]*>\s*>)*)$', line)
1980 line = class_decl_match.group(5)
1993 line)
2013 # Consume braces or semicolons from what's left of the line
2016 matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line)
2029 if _MATCH_ASM.match(line):
2047 line = matched.group(2)
2105 linenum: The number of the line to check.
2109 filename, line number, error level, and message
2112 # Remove comments from the line, but leave in strings for now.
2113 line = clean_lines.lines[linenum]
2115 if Search(r'printf\s*\(.*".*%[-+ ]?\d*q', line):
2119 if Search(r'printf\s*\(.*".*%\d+\$', line):
2124 line = line.replace('\\\\', '')
2126 if Search(r'("|\').*\\(%|\[|\(|{)', line):
2131 line = clean_lines.elided[linenum]
2137 line):
2141 if Match(r'\s*#\s*endif\s*[^/\s]+', line):
2145 if Match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line):
2147 'Inner-style forward declarations are invalid. Remove this line.')
2150 line):
2154 if Search(r'^\s*const\s*string\s*&\s*\w+\s*;', line):
2181 line)
2190 def CheckSpacingForFunctionCall(filename, line, linenum, error):
2195 line: The text of the line to check.
2196 linenum: The number of the line to check.
2204 fncall = line # if there's no control flow construct, look at whole line
2209 match = Search(pattern, line)
2252 'Closing ) should be moved to the previous line')
2258 def IsBlankLine(line):
2259 """Returns true if the given line is blank.
2261 We consider a line to be blank if the line is empty or consists of
2265 line: A line of a string.
2268 True, if the given line is blank.
2270 return not line or line.isspace()
2287 NOLINT *on the last line of a function* disables this check.
2292 linenum: The number of the line to check.
2297 line = lines[linenum]
2304 match_result = Match(regexp, line)
2323 function = Search(r'((\w|:)*)\(', line).group(1)
2336 elif Match(r'^\}\s*$', line): # function end
2339 elif not Match(r'^\s*$', line):
2350 comment: The text of the comment from the line in question.
2352 linenum: The number of the line to check.
2381 linenum: The number of the line to check.
2386 line = clean_lines.elided[linenum] # get rid of comments and strings
2390 r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
2411 linenum: Current line number.
2412 init_suffix: Remainder of the current line after the initial <.
2417 line = init_suffix
2428 match = Search(r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$', line)
2432 line = match.group(2)
2463 # Scan the next line
2467 line = clean_lines.elided[linenum]
2480 linenum: Current line number.
2481 init_prefix: Part of the current line before the initial >.
2486 line = init_prefix
2490 match = Search(r'^(.*)([<>(),;\[\]])[^<>(),;\[\]]*$', line)
2494 line = match.group(1)
2522 # Scan the previous line
2526 line = clean_lines.elided[linenum]
2538 line, don't end a function with a blank line, don't add a blank line
2544 linenum: The number of the line to check.
2554 line = raw[linenum]
2556 # Before nixing comments, check if the line is blank for no good
2557 # reason. This includes the first line after a block is opened, and
2558 # blank lines at the end of a function (ie, right before a line like '}'
2560 # Skip all the blank line checks if we are immediately inside a
2561 # namespace body. In other words, don't issue blank line warnings
2568 if IsBlankLine(line) and not nesting_state.InNamespaceBody():
2572 # TODO(unknown): Don't complain if line before blank line, and line after,
2577 # OK, we have a blank line at the start of a code block. Before we
2579 # non-empty line has the parameters of a function header that are indented
2580 # 4 spaces (because they did not fit in a 80 column line when placed on
2581 # the same line as the function name). We also check for the case where
2582 # the previous line is indented 6 spaces, which may happen when the
2583 # initializers of a constructor do not fit into a 80 column line.
2596 # simple heuristic here: If the line is indented 4 spaces; and we have a
2598 # or colon (for initializer lists) we assume that it is the last line of
2607 'Redundant blank line at the start of a code block '
2612 # // Something followed by a blank line
2623 'Redundant blank line at the end of a code block '
2629 'Do not leave a blank line after "%s:"' % matched.group(1))
2632 commentpos = line.find('//')
2636 if (line.count('"', 0, commentpos) -
2637 line.count('\\"', 0, commentpos)) % 2 == 0: # not in quotes
2639 if (not Match(r'^\s*{ //', line) and
2641 line[commentpos-1] not in string.whitespace) or
2643 line[commentpos-2] not in string.whitespace))):
2648 if commentend < len(line) and not line[commentend] == ' ':
2659 match = (Search(r'[=/-]{4,}\s*$', line[commentend:]) or
2660 Search(r'^/$', line[commentend:]) or
2661 Search(r'^!< ', line[commentend:]) or
2662 Search(r'^/< ', line[commentend:]) or
2663 Search(r'^/+ ', line[commentend:]))
2667 CheckComment(line[commentpos:], filename, linenum, error)
2669 line = clean_lines.elided[linenum] # get rid of comments and strings
2672 line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', 'operator\(', line)
2678 if Search(r'[\w.]=[\w.]', line) and not Search(r'\b(if|while) ', line):
2690 match = Search(r'[^<>=!\s](==|!=|<=|>=)[^<>=!\s]', line)
2697 match = Search(r'(operator|\S)(?:L|UL|ULL|l|ul|ull)?<<(\S)', line)
2703 elif not Match(r'#.*include', line):
2705 reduced_line = line.replace('->', '')
2739 match = Search(r'>>[a-zA-Z_]', line)
2745 match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
2751 match = Search(r' (if\(|for\(|while\(|switch\()', line)
2763 line)
2768 not match.group(2) and Search(r'\bfor\s*\(.*; \)', line)):
2786 if Search(r',[^,\s]', line) and Search(r',[^,\s]', raw[linenum]):
2794 if Search(r';[^\s};\\)/]', line):
2799 CheckSpacingForFunctionCall(filename, line, linenum, error)
2803 # braces. And since you should never have braces at the beginning of a line,
2805 match = Match(r'^(.*[^ ({]){', line)
2846 if Search(r'}else', line):
2852 if Search(r'\w\s+\[', line) and not Search(r'delete\s+\[', line):
2856 # You shouldn't have a space before a semicolon at the end of the line.
2859 if Search(r':\s*;\s*$', line):
2862 elif Search(r'^\s*;\s*$', line):
2866 elif (Search(r'\s+;\s*$', line) and
2867 not Search(r'\bfor\b', line)):
2874 if (Search('for *\(.*[^:]:[^: ]', line) or
2875 Search('for *\(.*[^: ]:[^:]', line)):
2881 """Checks for additional blank line issues related to sections.
2883 Currently the only thing checked here is blank line before protected/private.
2889 linenum: The number of the line to check.
2897 # Also skip checks if we are on the first line. This accounts for
2909 # Issue warning if the line before public/protected/private was
2910 # not a blank line, but don't do this if the previous line contains
2915 # Also ignores cases where the previous line ends with a backslash as can be
2922 # account for multi-line base-specifier lists, e.g.:
2932 '"%s:" should be preceded by a blank line' % matched.group(1))
2936 """Return the most recent non-blank line and its line number.
2940 linenum: The number of the line to check.
2944 non-blank line before the current line, or the empty string if this is the
2945 first non-blank line. The second is the line number of that line, or -1
2946 if this is the first non-blank line.
2952 if not IsBlankLine(prevline): # if not a blank line...
2959 """Looks for misplaced braces (e.g. at the end of line).
2964 linenum: The number of the line to check.
2968 line = clean_lines.elided[linenum] # get rid of comments and strings
2970 if Match(r'\s*{\s*$', line):
2971 # We allow an open brace to start a line in the case where someone is using
2976 # the previous non-blank line is ',', ';', ':', '(', '{', or '}', or if the
2977 # previous line starts a preprocessor block.
2982 '{ should almost always be at the end of the previous line')
2984 # An else clause should be on the same line as the preceding closing brace.
2985 if Match(r'\s*else\s*', line):
2989 'An else should appear on the same line as the preceding }')
2993 if Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line):
2994 if Search(r'}\s*else if([^{]*)$', line): # could be multi-line if
2996 pos = line.find('else if')
2997 pos = line.find('(', pos)
3003 else: # common case: else not followed by a multi-line if
3007 # Likewise, an else should never have the else clause on the same line
3008 if Search(r'\belse [^\s{]', line) and not Search(r'\belse if\b', line):
3010 'Else clause should never be on same line as else (use 2 lines)')
3012 # In the same way, a do/while should never be on one line
3013 if Match(r'\s*do [^\s{]', line):
3015 'do/while clauses should not be on a single line')
3061 match = Match(r'^(.*\)\s*)\{', line)
3067 # - multi-line macro that defines a base class
3102 match = Match(r'^(.*(?:else|\)\s*const)\s*)\{', line)
3106 # Note that we can't simply concatenate the previous line to the
3107 # current line and do a single match, otherwise we may output
3108 # duplicate warnings for the blank line case:
3110 # // blank line
3114 match = Match(r'^(\s*)\{', line)
3138 linenum: The number of the line to check.
3142 # Search for loop keywords at the beginning of the line. Because only
3148 line = clean_lines.elided[linenum]
3149 matched = Match(r'\s*(for|while|if)\s*\(', line)
3153 clean_lines, linenum, line.find('('))
3173 linenum: The number of the line to check.
3196 # Don't waste time here if line doesn't contain 'CHECK' or 'EXPECT'
3300 linenum: The number of the line to check.
3303 line = clean_lines.elided[linenum]
3306 if Match(r'^\s*#', line):
3309 # Last ditch effort to avoid multi-line comments. This will not help
3310 # if the comment started before the current line or ended after the
3311 # current line, but it catches most of the false positives. At least,
3313 # multi-line comments in preprocessor macros.
3316 # multi-line comments.
3317 if line.find('/*') >= 0 or line.find('*/') >= 0:
3320 for match in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(line):
3326 def GetLineWidth(line):
3327 """Determines the width of the line in column positions.
3330 line: A string, which may be a Unicode string.
3333 The width of the line in column positions, accounting for Unicode
3336 if isinstance(line, unicode):
3338 for uc in unicodedata.normalize('NFC', line):
3345 return len(line)
3353 do what we can. In particular we check for 2-space indents, line lengths,
3359 linenum: The number of the line to check.
3370 line = raw_lines[linenum]
3372 if line.find('\t') != -1:
3376 # One or three blank spaces at the beginning of the line is weird; it's
3390 while initial_spaces < len(line) and line[initial_spaces] == ' ':
3392 if line and line[-1].isspace():
3399 'Weird number of spaces at line-start. '
3402 # Check if the line is a header guard.
3406 if (line.startswith('#ifndef %s' % cppvar) or
3407 line.startswith('#define %s' % cppvar) or
3408 line.startswith('#endif // %s' % cppvar)):
3418 if (not line.startswith('#include') and not is_header_guard and
3419 not Match(r'^\s*//.*http(s?)://\S*$', line) and
3420 not Match(r'^// \$Id:.*#[0-9]+ \$$', line)):
3421 line_width = GetLineWidth(line)
3436 # It's ok to have many commands in a switch case that fits in 1 line
3441 'More than one command on the same line')
3572 Strings on #include lines are NOT removed from elided line, to make
3579 linenum: The number of the line to check.
3585 line = clean_lines.lines[linenum]
3588 if _RE_PATTERN_INCLUDE_NEW_STYLE.search(line):
3595 match = _RE_PATTERN_INCLUDE.search(line)
3631 match = _RE_PATTERN_INCLUDE.match(line)
3654 It can be single line and can span multiple lines.
3733 linenum: The number of the line to check.
3740 # If the line is empty or consists of entirely a comment, no need to
3742 line = clean_lines.elided[linenum]
3743 if not line:
3746 match = _RE_PATTERN_INCLUDE.search(line)
3753 if Match(r'^\s*#\s*(?:ifdef|elif|else|endif)\b', line):
3768 r'(\([^)].*)', line)
3785 not (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
3786 Search(r'\bMockCallback<.*>', line) or
3787 Search(r'\bstd::function<.*>', line)) and
3810 CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3818 if CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3823 CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3831 r'(?:&(static|dynamic|down|reinterpret)_cast\b)', line)
3840 # line.
3842 extended_line = line + clean_lines.elided[linenum + 1]
3844 extended_line = line
3851 line)
3860 not Search(r'\boperator\W', line) and
3867 if Search(r'\b([A-Za-z0-9_]*_)\(\1\)', line):
3881 if Search(r'\bshort port\b', line):
3882 if not Search(r'\bunsigned short port\b', line):
3886 match = Search(r'\b(short|long(?! +double)|long long)\b', line)
3892 match = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line)
3900 if Search(r'\bsprintf\b', line):
3903 match = Search(r'\b(strcpy|strcat)\b', line)
3909 # TODO(unknown): catch out-of-line unary operator&:
3914 if Search(r'\boperator\s*&\s*\(\s*\)', line):
3920 if Search(r'\}\s*if\s*\(', line):
3922 'Did you mean "else if"? If not, start a new line for "if".')
3928 # convention of the whole function to process multiple line to handle it.
3931 printf_args = _GetTextInside(line, r'(?i)\b(string)?printf\s*\(')
3936 line, re.I).group(1)
3942 match = Search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
3948 if Search(r'\busing namespace\b', line):
3954 match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
3999 line)
4016 and Search(r'\bnamespace\s*{', line)
4017 and line[-1] != '\\'):
4028 line, instead of scanning forward.
4033 linenum: The number of the line to check.
4038 # Do nothing if there is no '&' on current line.
4039 line = clean_lines.elided[linenum]
4040 if '&' not in line:
4053 # line to current line so that we can match const references
4056 # Note that this only scans back one line, since scanning back
4061 if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line):
4065 elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line):
4070 line = previous.group(1) + line.lstrip()
4073 endpos = line.rfind('>')
4078 # Found the matching < on an earlier line, collect all
4079 # pieces up to current line.
4080 line = ''
4082 line += clean_lines.elided[i].strip()
4099 elif Match(r'.*{\s*$', line):
4114 if Search(whitelisted_functions, line):
4116 elif not Search(r'\S+\([^)]*$', line):
4117 # Don't see a whitelisted function on this line. Actually we
4118 # didn't see any function name on this line, so this is likely a
4119 # multi-line parameter list. Try a bit harder to catch this case.
4127 decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body
4136 def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
4142 linenum: The number of the line to check.
4143 line: The line of code to check.
4144 raw_line: The raw line of code to check, with comments.
4154 match = Search(pattern, line)
4159 sizeof_match = Match(r'.*sizeof\s*$', line[0:match.start(1) - 1])
4166 if (line[0:match.start(1) - 1].endswith(' operator++') or
4167 line[0:match.start(1) - 1].endswith(' operator--')):
4193 remainder = line[match.end(0):]
4211 if Match(r'.*\)\s*$', line[0:match.start(0)]):
4362 for line in headerfile:
4364 clean_line = CleanseComments(line)
4396 line = clean_lines.elided[linenum]
4397 if not line or line[0] == '#':
4401 matched = _RE_PATTERN_STRING.search(line)
4404 # (We check only the first match per line; good enough.)
4405 prefix = line[:matched.start()]
4410 if pattern.search(line):
4414 if not '<' in line: # Reduces the cpu time usage by skipping lines.
4418 if pattern.search(line):
4479 linenum: The number of the line to check.
4482 line = clean_lines.elided[linenum]
4483 match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line)
4491 def ProcessLine(filename, file_extension, clean_lines, line,
4494 """Processes a single line in the file.
4499 clean_lines: An array of strings, each representing a line of the file,
4501 line: Number of line being processed.
4507 filename, line number, error level, and message
4509 run on each source line. Each function takes 4
4510 arguments: filename, clean_lines, line, error
4513 ParseNolintSuppressions(filename, raw_lines[line], line, error)
4514 nesting_state.Update(filename, clean_lines, line, error)
4517 CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
4518 CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
4519 CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error)
4520 CheckLanguage(filename, clean_lines, line, file_extension, include_state,
4522 CheckForNonConstReference(filename, clean_lines, line, nesting_state, error)
4523 CheckForNonStandardConstructs(filename, clean_lines, line,
4525 CheckVlogArguments(filename, clean_lines, line, error)
4526 CheckPosixThreading(filename, clean_lines, line, error)
4527 CheckInvalidIncrement(filename, clean_lines, line, error)
4528 CheckMakePairUsesDeduction(filename, clean_lines, line, error)
4530 check_fn(filename, clean_lines, line, error)
4539 lines: An array of strings, each representing a line of the file, with the
4542 filename, line number, error level, and message
4544 run on each source line. Each function takes 4
4545 arguments: filename, clean_lines, line, error
4547 lines = (['// marker so line numbers and indices both start at 1'] + lines +
4548 ['// marker so line numbers end in a known way'])
4563 for line in xrange(clean_lines.NumLines()):
4564 ProcessLine(filename, file_extension, clean_lines, line,
4587 run on each source line. Each function takes 4
4588 arguments: filename, clean_lines, line, error
4668 """Parses the command line arguments.
4673 args: The command line arguments: