Home | History | Annotate | Download | only in tools

Lines Matching full:linenum

360 def ParseNolintSuppressions(filename, raw_line, linenum, error):
370 linenum: int, the number of the current line.
378 _error_suppressions.setdefault(None, set()).add(linenum)
383 _error_suppressions.setdefault(category, set()).add(linenum)
385 error(filename, linenum, 'readability/nolint', 5,
394 def IsErrorSuppressedByNolint(category, linenum):
402 linenum: int, the current line number.
406 return (linenum in _error_suppressions.get(category, set()) or
407 linenum in _error_suppressions.get(None, set()))
700 def Check(self, error, filename, linenum):
706 linenum: The number of the line to check.
723 error(filename, linenum, 'readability/fn_size', error_level,
832 def _ShouldPrintError(category, confidence, linenum):
838 if IsErrorSuppressedByNolint(category, linenum):
859 def Error(filename, linenum, category, confidence, message):
872 linenum: The number of the line containing the error.
881 if _ShouldPrintError(category, confidence, linenum):
885 filename, linenum, message, category, confidence))
888 filename, linenum, message, category, confidence))
891 filename, linenum, message, category, confidence))
1007 for linenum in range(len(lines)):
1008 self.lines.append(CleanseComments(lines[linenum]))
1009 elided = self._CollapseStrings(lines[linenum])
1061 def CloseExpression(clean_lines, linenum, pos):
1064 If lines[linenum][pos] points to a '(' or '{' or '[', finds the
1065 linenum/pos that correspond to the closing of the expression.
1069 linenum: The number of the line to check.
1073 A tuple (line, linenum, pos) pointer *past* the closing brace, or
1076 'cleansed' line at linenum.
1079 line = clean_lines.elided[linenum]
1090 return (line, linenum, end_pos)
1093 while linenum < clean_lines.NumLines() - 1:
1094 linenum += 1
1095 line = clean_lines.elided[linenum]
1098 return (line, linenum,
1161 for linenum, line in enumerate(lines):
1168 ifndef_linenum = linenum
1174 endif_linenum = linenum
1230 for linenum, line in enumerate(lines):
1232 error(filename, linenum, 'readability/utf8', 5,
1254 def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
1268 linenum: The number of the line to check.
1271 line = clean_lines.elided[linenum]
1278 error(filename, linenum, 'readability/multiline_comment', 5,
1286 error(filename, linenum, 'readability/multiline_string', 5,
1309 def CheckPosixThreading(filename, clean_lines, linenum, error):
1321 linenum: The number of the line to check.
1324 line = clean_lines.elided[linenum]
1330 error(filename, linenum, 'runtime/threadsafe_fn', 2,
1342 def CheckInvalidIncrement(filename, clean_lines, linenum, error):
1355 linenum: The number of the line to check.
1358 line = clean_lines.elided[linenum
1360 error(filename, linenum, 'runtime/invalid_increment', 5,
1372 def CheckBegin(self, filename, clean_lines, linenum, error):
1382 linenum: The number of the line to check.
1387 def CheckEnd(self, filename, clean_lines, linenum, error):
1395 linenum: The number of the line to check.
1404 def __init__(self, name, class_or_struct, clean_lines, linenum):
1407 self.starting_linenum = linenum
1421 for i in range(linenum, clean_lines.NumLines()):
1428 def CheckBegin(self, filename, clean_lines, linenum, error):
1430 if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]):
1437 def __init__(self, name, linenum):
1440 self.starting_linenum = linenum
1442 def CheckEnd(self, filename, clean_lines, linenum, error):
1444 line = clean_lines.raw_lines[linenum]
1457 if (linenum - self.starting_linenum < 10
1478 error(filename, linenum, 'readability/namespace', 5,
1484 error(filename, linenum, 'readability/namespace', 5,
1591 def Update(self, filename, clean_lines, linenum, error):
1597 linenum: The number of the line to check.
1600 line = clean_lines.elided[linenum]
1640 new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
1677 clean_lines, linenum))
1683 self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
1723 self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
1757 def CheckForNonStandardConstructs(filename, clean_lines, linenum,
1779 linenum: The number of the line to check.
1787 line = clean_lines.lines[linenum]
1790 error(filename, linenum, 'runtime/printf_format', 3,
1794 error(filename, linenum, 'runtime/printf_format', 2,
1801 error(filename, linenum, 'build/printf_format', 3,
1805 line = clean_lines.elided[linenum]
1812 error(filename, linenum, 'build/storage_class', 5,
1816 error(filename, linenum, 'build/endif_comment', 5,
1820 error(filename, linenum, 'build/forward_decl', 5,
1825 error(filename, linenum, 'build/deprecated', 3,
1836 error(filename, linenum, 'runtime/member_string_references', 2,
1860 error(filename, linenum, 'runtime/explicit', 5,
1864 def CheckSpacingForFunctionCall(filename, line, linenum, error):
1870 linenum: The number of the line to check.
1911 error(filename, linenum, 'whitespace/parens', 4,
1914 error(filename, linenum, 'whitespace/parens', 2,
1919 error(filename, linenum, 'whitespace/parens', 4,
1927 error(filename, linenum, 'whitespace/parens', 2,
1930 error(filename, linenum, 'whitespace/parens', 2,
1949 def CheckForFunctionLengths(filename, clean_lines, linenum,
1968 linenum: The number of the line to check.
1973 line = lines[linenum]
1975 raw_line = raw[linenum]
1991 for start_linenum in xrange(linenum, clean_lines.NumLines()):
2010 error(filename, linenum, 'readability/fn_size', 5,
2013 function_state.Check(error, filename, linenum)
2022 def CheckComment(comment, filename, linenum, error):
2028 linenum: The number of the line to check.
2036 error(filename, linenum, 'whitespace/todo', 2,
2041 error(filename, linenum, 'readability/todo', 2,
2048 error(filename, linenum, 'whitespace/todo', 2,
2051 def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
2057 linenum: The number of the line to check.
2062 line = clean_lines.elided[linenum] # get rid of comments and strings
2071 error(filename, linenum, 'readability/constructors', 3,
2082 def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
2087 linenum: Current line number.
2141 linenum += 1
2142 if linenum >= len(clean_lines.elided):
2144 line = clean_lines.elided[linenum]
2152 def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
2157 linenum: Current line number.
2200 linenum -= 1
2201 if linenum < 0:
2203 line = clean_lines.elided[linenum]
2209 def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
2221 linenum: The number of the line to check.
2228 line = raw[linenum]
2244 prev_line = elided[linenum - 1]
2262 search_position = linenum-2
2280 error(filename, linenum, 'whitespace/blank_line', 2,
2290 if linenum + 1 < clean_lines.NumLines():
2291 next_line = raw[linenum + 1]
2295 error(filename, linenum, 'whitespace/blank_line', 3,
2300 error(filename, linenum, 'whitespace/blank_line', 3,
2316 error(filename, linenum, 'whitespace/comments', 2,
2332 error(filename, linenum, 'whitespace/comments', 4,
2334 CheckComment(line[commentpos:], filename, linenum, error)
2336 line = clean_lines.elided[linenum] # get rid of comments and strings
2346 error(filename, linenum, 'whitespace/operators', 4,
2359 error(filename, linenum, 'whitespace/operators', 3,
2365 error(filename, linenum, 'whitespace/operators', 3,
2377 not FindNextMatchingAngleBracket(clean_lines, linenum, match.group(1))):
2378 error(filename, linenum, 'whitespace/operators', 3,
2386 not FindPreviousMatchingAngleBracket(clean_lines, linenum,
2388 error(filename, linenum, 'whitespace/operators', 3,
2405 error(filename, linenum, 'whitespace/operators', 3,
2411 error(filename, linenum, 'whitespace/operators', 4,
2417 error(filename, linenum, 'whitespace/parens', 5,
2433 error(filename, linenum, 'whitespace/parens', 5,
2436 error(filename, linenum, 'whitespace/parens', 5,
2442 error(filename, linenum, 'whitespace/comma', 3,
2450 error(filename, linenum, 'whitespace/semicolon', 3,
2454 CheckSpacingForFunctionCall(filename, line, linenum, error)
2461 error(filename, linenum, 'whitespace/braces', 5,
2466 error(filename, linenum, 'whitespace/braces', 5,
2472 error(filename, linenum, 'whitespace/braces', 5,
2479 error(filename, linenum, 'whitespace/semicolon', 5,
2482 error(filename, linenum, 'whitespace/semicolon', 5,
2487 error(filename, linenum, 'whitespace/semicolon', 5,
2495 error(filename, linenum, 'whitespace/forcolon', 2,
2499 def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
2508 linenum: The number of the line to check.
2523 linenum <= class_info.starting_linenum):
2526 matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
2536 prev_line = clean_lines.lines[linenum - 1]
2545 for i in range(class_info.starting_linenum, linenum):
2549 if end_class_head < linenum - 1:
2550 error(filename, linenum, 'whitespace/blank_line', 3,
2554 def GetPreviousNonBlankLine(clean_lines, linenum):
2559 linenum: The number of the line to check.
2568 prevlinenum = linenum - 1
2577 def CheckBraces(filename, clean_lines, linenum, error):
2583 linenum: The number of the line to check.
2587 line = clean_lines.elided[linenum] # get rid of comments and strings
2597 prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
2600 error(filename, linenum, 'whitespace/braces', 4,
2605 prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
2607 error(filename, linenum, 'whitespace/newline', 4,
2618 (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
2620 error(filename, linenum, 'readability/braces', 5,
2623 error(filename, linenum, 'readability/braces', 5,
2628 error(filename, linenum, 'whitespace/newline', 4,
2633 error(filename, linenum, 'whitespace/newline', 4,
2639 prevlinenum = linenum
2649 error(filename, linenum, 'readability/braces', 4,
2653 def CheckEmptyLoopBody(filename, clean_lines, linenum, error):
2659 linenum: The number of the line to check.
2666 line = clean_lines.elided[linenum]
2670 clean_lines, linenum, line.find('('))
2715 def CheckCheck(filename, clean_lines, linenum, error):
2721 linenum: The number of the line to check.
2729 if raw_lines[linenum].find(macro) >= 0:
2736 line = clean_lines.elided[linenum] # get rid of comments and strings
2741 error(filename, linenum, 'readability/check', 2,
2748 def CheckAltTokens(filename, clean_lines, linenum, error):
2754 linenum: The number of the line to check.
2757 line = clean_lines.elided[linenum]
2775 error(filename, linenum, 'readability/alt_tokens', 2,
2802 def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
2813 linenum: The number of the line to check.
2821 line = raw_lines[linenum]
2824 error(filename, linenum, 'whitespace/tab', 1,
2840 cleansed_line = clean_lines.elided[linenum]
2844 error(filename, linenum, 'whitespace/end_of_line', 4,
2849 error(filename, linenum, 'whitespace/indent', 3,
2855 error(filename, linenum, 'whitespace/labels', 4,
2883 error(filename, linenum, 'whitespace/line_length', 4,
2886 error(filename, linenum, 'whitespace/line_length', 2,
2892 (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or
2893 GetPreviousNonBlankLine(clean_lines, linenum)[0].find(';') != -1) and
2898 error(filename, linenum, 'whitespace/newline', 0,
2902 CheckBraces(filename, clean_lines, linenum, error)
2903 CheckEmptyLoopBody(filename, clean_lines, linenum, error)
2904 CheckAccess(filename, clean_lines, linenum, nesting_state, error)
2905 CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
2906 CheckCheck(filename, clean_lines, linenum, error)
2907 CheckAltTokens(filename, clean_lines, linenum, error)
2910 CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
3028 def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
3038 linenum: The number of the line to check.
3044 line = clean_lines.lines[linenum]
3048 error(filename, linenum, 'build/include', 4,
3059 error(filename, linenum, 'build/include', 4,
3063 include_state[include] = linenum
3079 error(filename, linenum, 'build/include_order', 4,
3083 error(filename, linenum, 'build/include_alpha', 4,
3093 error(filename, linenum, 'readability/streams', 3,
3153 def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
3163 linenum: The number of the line to check.
3170 line = clean_lines.elided[linenum]
3176 CheckIncludeLine(filename, clean_lines, linenum, include_state, error)
3182 if linenum + 1 < clean_lines.NumLines():
3183 extended_line = line + clean_lines.elided[linenum + 1]
3213 error(filename, linenum, 'runtime/references', 2,
3246 if (linenum == 0 or
3248 clean_lines.elided[linenum - 1])):
3249 error(filename, linenum, 'readability/casting', 4,
3254 CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3262 if CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3267 CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
3275 error(filename, linenum, 'runtime/casting', 4,
3291 error(filename, linenum, 'runtime/string', 4,
3298 error(filename, linenum, 'runtime/rtti', 5,
3304 error(filename, linenum, 'runtime/init', 4,
3319 error(filename, linenum, 'runtime/int', 4,
3324 error(filename, linenum, 'runtime/int', 4,
3331 error(filename, linenum, 'runtime/printf', 3,
3337 error(filename, linenum, 'runtime/printf', 5,
3341 error(filename, linenum, 'runtime/printf', 4,
3345 error(filename, linenum, 'runtime/printf', 1,
3355 error(filename, linenum, 'runtime/operator', 4,
3361 error(filename, linenum, 'readability/braces', 4,
3377 error(filename, linenum, 'runtime/printf', 4,
3384 error(filename, linenum, 'runtime/memset', 4,
3389 error(filename, linenum, 'build/namespaces', 5,
3428 error(filename, linenum, 'runtime/arrays', 1,
3440 if match and linenum + 1 < clean_lines.NumLines():
3441 next_line = clean_lines.elided[linenum + 1]
3449 error(filename, linenum, 'readability/constructors', 3,
3458 error(filename, linenum, 'build/namespaces', 4,
3464 def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
3472 linenum: The number of the line to check.
3491 error(filename, linenum, 'runtime/sizeof', 1,
3520 error(filename, linenum, 'readability/function', 3,
3525 error(filename, linenum, 'readability/casting', 4,
3661 linenum = 0
3663 linenum += 1
3670 include_state.setdefault(include, '%s:%d' % (filename, linenum))
3695 for linenum in xrange(clean_lines.NumLines()):
3696 line = clean_lines.elided[linenum]
3707 required['<string>'] = (linenum, 'string')
3711 required[header] = (linenum, template)
3719 required[header] = (linenum, template)
3770 def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error):
3779 linenum: The number of the line to check.
3783 line = raw[linenum]
3786 error(filename, linenum, 'build/explicit_make_pair',
3913 for linenum in range(len(lines)):
3914 if lines[linenum].endswith('\r'):
3915 lines[linenum] = lines[linenum].rstrip('\r')
3935 # Use 0 for linenum since outputting only one error for potentially