Lines Matching refs:linenum
578 def ParseNolintSuppressions(filename, raw_line, linenum, error): argument
594 suppressed_line = linenum + 1
596 suppressed_line = linenum
606 error(filename, linenum, 'readability/nolint', 5,
634 def IsErrorSuppressedByNolint(category, linenum): argument
648 linenum in _error_suppressions.get(category, set()) or
649 linenum in _error_suppressions.get(None, set()))
782 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path): argument
799 Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])):
1054 def Check(self, error, filename, linenum): argument
1076 error(filename, linenum, 'readability/fn_size', error_level,
1183 def _ShouldPrintError(category, confidence, linenum): argument
1189 if IsErrorSuppressedByNolint(category, linenum):
1211 def Error(filename, linenum, category, confidence, message): argument
1233 if _ShouldPrintError(category, confidence, linenum):
1237 filename, linenum, category, message, confidence))
1240 filename, linenum, message, category, confidence))
1243 filename, linenum, message, category, confidence))
1436 for linenum in range(len(self.lines_without_raw_strings)):
1438 self.lines_without_raw_strings[linenum]))
1439 elided = self._CollapseStrings(self.lines_without_raw_strings[linenum])
1592 def CloseExpression(clean_lines, linenum, pos): argument
1615 line = clean_lines.elided[linenum]
1622 return (line, linenum, end_pos)
1625 while stack and linenum < clean_lines.NumLines() - 1:
1626 linenum += 1
1627 line = clean_lines.elided[linenum]
1630 return (line, linenum, end_pos)
1713 def ReverseCloseExpression(clean_lines, linenum, pos): argument
1730 line = clean_lines.elided[linenum]
1737 return (line, linenum, start_pos)
1740 while stack and linenum > 0:
1741 linenum -= 1
1742 line = clean_lines.elided[linenum]
1745 return (line, linenum, start_pos)
1910 for linenum, line in enumerate(raw_lines):
1917 ifndef_linenum = linenum
1923 endif_linenum = linenum
2020 for linenum, line in enumerate(lines):
2022 error(filename, linenum, 'readability/utf8', 5,
2025 error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')
2046 def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error): argument
2063 line = clean_lines.elided[linenum]
2070 error(filename, linenum, 'readability/multiline_comment', 5,
2078 error(filename, linenum, 'readability/multiline_string', 5,
2114 def CheckPosixThreading(filename, clean_lines, linenum, error): argument
2129 line = clean_lines.elided[linenum]
2134 error(filename, linenum, 'runtime/threadsafe_fn', 2,
2140 def CheckVlogArguments(filename, clean_lines, linenum, error): argument
2152 line = clean_lines.elided[linenum]
2154 error(filename, linenum, 'runtime/vlog', 5,
2164 def CheckInvalidIncrement(filename, clean_lines, linenum, error): argument
2180 line = clean_lines.elided[linenum]
2182 error(filename, linenum, 'runtime/invalid_increment', 5,
2186 def IsMacroDefinition(clean_lines, linenum): argument
2187 if Search(r'^#define', clean_lines[linenum]):
2190 if linenum > 0 and Search(r'\\$', clean_lines[linenum - 1]):
2196 def IsForwardClassDeclaration(clean_lines, linenum): argument
2197 return Match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum])
2203 def __init__(self, linenum, seen_open_brace): argument
2204 self.starting_linenum = linenum
2210 def CheckBegin(self, filename, clean_lines, linenum, error): argument
2225 def CheckEnd(self, filename, clean_lines, linenum, error): argument
2253 def __init__(self, linenum): argument
2254 _BlockInfo.__init__(self, linenum, True)
2260 def __init__(self, name, class_or_struct, clean_lines, linenum): argument
2261 _BlockInfo.__init__(self, linenum, False)
2274 self.class_indent = GetIndentLevel(clean_lines.raw_lines[linenum])
2283 for i in range(linenum, clean_lines.NumLines()):
2290 def CheckBegin(self, filename, clean_lines, linenum, error): argument
2292 if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]):
2295 def CheckEnd(self, filename, clean_lines, linenum, error): argument
2299 for i in xrange(linenum - 1, self.starting_linenum, -1):
2316 indent = Match(r'^( *)\}', clean_lines.elided[linenum])
2322 error(filename, linenum, 'whitespace/indent', 3,
2329 def __init__(self, name, linenum): argument
2330 _BlockInfo.__init__(self, linenum, False)
2334 def CheckEnd(self, filename, clean_lines, linenum, error): argument
2336 line = clean_lines.raw_lines[linenum]
2349 if (linenum - self.starting_linenum < 10
2370 error(filename, linenum, 'readability/namespace', 5,
2379 error(filename, linenum, 'readability/namespace', 5,
2383 error(filename, linenum, 'readability/namespace', 5,
2468 def InTemplateArgumentList(self, clean_lines, linenum, pos): argument
2478 while linenum < clean_lines.NumLines():
2480 line = clean_lines.elided[linenum]
2483 linenum += 1
2506 linenum += 1
2512 (_, end_line, end_pos) = CloseExpression(clean_lines, linenum, pos - 1)
2516 linenum = end_line
2577 def Update(self, filename, clean_lines, linenum, error): argument
2586 line = clean_lines.elided[linenum]
2636 new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
2665 if not self.InTemplateArgumentList(clean_lines, linenum, end_declaration):
2668 clean_lines, linenum))
2674 self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
2698 error(filename, linenum, 'whitespace/indent', 3,
2717 self.stack.append(_ExternCInfo(linenum))
2719 self.stack.append(_BlockInfo(linenum, True))
2737 self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
2775 def CheckForNonStandardConstructs(filename, clean_lines, linenum, argument
2805 line = clean_lines.lines[linenum]
2808 error(filename, linenum, 'runtime/printf_format', 3,
2812 error(filename, linenum, 'runtime/printf_format', 2,
2819 error(filename, linenum, 'build/printf_format', 3,
2823 line = clean_lines.elided[linenum]
2830 error(filename, linenum, 'build/storage_class', 5,
2835 error(filename, linenum, 'build/endif_comment', 5,
2839 error(filename, linenum, 'build/forward_decl', 5,
2844 error(filename, linenum, 'build/deprecated', 3,
2855 error(filename, linenum, 'runtime/member_string_references', 2,
2923 error(filename, linenum, 'runtime/explicit', 5,
2927 error(filename, linenum, 'runtime/explicit', 5,
2931 error(filename, linenum, 'runtime/explicit', 5,
2935 def CheckSpacingForFunctionCall(filename, clean_lines, linenum, error): argument
2944 line = clean_lines.elided[linenum]
2981 error(filename, linenum, 'whitespace/parens', 4,
2984 error(filename, linenum, 'whitespace/parens', 2,
2994 error(filename, linenum, 'whitespace/parens', 0,
2997 error(filename, linenum, 'whitespace/parens', 4,
3005 error(filename, linenum, 'whitespace/parens', 2,
3008 error(filename, linenum, 'whitespace/parens', 2,
3041 def CheckForFunctionLengths(filename, clean_lines, linenum, argument
3065 line = lines[linenum]
3081 for start_linenum in xrange(linenum, clean_lines.NumLines()):
3100 error(filename, linenum, 'readability/fn_size', 5,
3103 function_state.Check(error, filename, linenum)
3112 def CheckComment(line, filename, linenum, next_line_start, error): argument
3132 error(filename, linenum, 'whitespace/comments', 2,
3142 error(filename, linenum, 'whitespace/todo', 2,
3147 error(filename, linenum, 'readability/todo', 2,
3154 error(filename, linenum, 'whitespace/todo', 2,
3162 error(filename, linenum, 'whitespace/comments', 4,
3166 def CheckSpacing(filename, clean_lines, linenum, nesting_state, error): argument
3188 line = raw[linenum]
3209 prev_line = elided[linenum - 1]
3227 search_position = linenum-2
3245 error(filename, linenum, 'whitespace/blank_line', 2,
3256 if linenum + 1 < clean_lines.NumLines():
3257 next_line = raw[linenum + 1]
3261 error(filename, linenum, 'whitespace/blank_line', 3,
3267 error(filename, linenum, 'whitespace/blank_line', 3,
3272 if linenum + 1 < clean_lines.NumLines():
3273 next_line = raw[linenum + 1]
3275 CheckComment(line, filename, linenum, next_line_start, error)
3278 line = clean_lines.elided[linenum]
3283 error(filename, linenum, 'whitespace/braces', 5,
3290 error(filename, linenum, 'whitespace/forcolon', 2,
3294 def CheckOperatorSpacing(filename, clean_lines, linenum, error): argument
3303 line = clean_lines.elided[linenum]
3328 error(filename, linenum, 'whitespace/operators', 4,
3348 error(filename, linenum, 'whitespace/operators', 3,
3358 clean_lines, linenum, len(match.group(1)))
3360 error(filename, linenum, 'whitespace/operators', 3,
3369 clean_lines, linenum, len(match.group(1)))
3371 error(filename, linenum, 'whitespace/operators', 3,
3382 error(filename, linenum, 'whitespace/operators', 3,
3399 error(filename, linenum, 'whitespace/operators', 3,
3405 error(filename, linenum, 'whitespace/operators', 4,
3409 def CheckParenthesisSpacing(filename, clean_lines, linenum, error): argument
3418 line = clean_lines.elided[linenum]
3423 error(filename, linenum, 'whitespace/parens', 5,
3439 error(filename, linenum, 'whitespace/parens', 5,
3442 error(filename, linenum, 'whitespace/parens', 5,
3447 def CheckCommaSpacing(filename, clean_lines, linenum, error): argument
3457 line = clean_lines.elided[linenum]
3470 Search(r',[^,\s]', raw[linenum])):
3471 error(filename, linenum, 'whitespace/comma', 3,
3479 error(filename, linenum, 'whitespace/semicolon', 3,
3546 def CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error): argument
3557 line = clean_lines.elided[linenum]
3598 clean_lines, linenum, len(match.group(1)))
3610 error(filename, linenum, 'whitespace/braces', 5,
3615 error(filename, linenum, 'whitespace/braces', 5,
3622 error(filename, linenum, 'whitespace/semicolon', 5,
3625 error(filename, linenum, 'whitespace/semicolon', 5,
3630 error(filename, linenum, 'whitespace/semicolon', 5,
3635 def IsDecltype(clean_lines, linenum, column): argument
3645 (text, _, start_col) = ReverseCloseExpression(clean_lines, linenum, column)
3653 def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error): argument
3677 linenum <= class_info.starting_linenum):
3680 matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
3690 prev_line = clean_lines.lines[linenum - 1]
3699 for i in range(class_info.starting_linenum, linenum):
3703 if end_class_head < linenum - 1:
3704 error(filename, linenum, 'whitespace/blank_line', 3,
3708 def GetPreviousNonBlankLine(clean_lines, linenum): argument
3722 prevlinenum = linenum - 1
3731 def CheckBraces(filename, clean_lines, linenum, error): argument
3741 line = clean_lines.elided[linenum] # get rid of comments and strings
3753 prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
3757 error(filename, linenum, 'whitespace/braces', 4,
3762 prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
3764 error(filename, linenum, 'whitespace/newline', 4,
3775 (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
3778 error(filename, linenum, 'readability/braces', 5,
3781 error(filename, linenum, 'readability/braces', 5,
3786 error(filename, linenum, 'whitespace/newline', 4,
3791 error(filename, linenum, 'whitespace/newline', 4,
3804 endline, endlinenum, endpos = line, linenum, if_else_match.end()
3809 (endline, endlinenum, endpos) = CloseExpression(clean_lines, linenum, pos)
3831 error(filename, linenum, 'readability/braces', 4,
3842 error(filename, linenum, 'readability/braces', 4,
3846 error(filename, linenum, 'readability/braces', 4,
3850 def CheckTrailingSemicolon(filename, clean_lines, linenum, error): argument
3860 line = clean_lines.elided[linenum]
3936 clean_lines, linenum, closing_brace_pos)
3969 prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
3976 clean_lines, linenum, len(match.group(1)))
3997 def CheckEmptyBlockBody(filename, clean_lines, linenum, error): argument
4013 line = clean_lines.elided[linenum]
4018 clean_lines, linenum, line.find('('))
4124 def CheckCheck(filename, clean_lines, linenum, error): argument
4136 (check_macro, start_pos) = FindCheckMacro(lines[linenum])
4142 clean_lines, linenum, start_pos)
4152 if linenum == end_line:
4153 expression = lines[linenum][start_pos + 1:end_pos - 1]
4155 expression = lines[linenum][start_pos + 1:]
4156 for i in xrange(linenum + 1, end_line):
4236 error(filename, linenum, 'readability/check', 2,
4242 def CheckAltTokens(filename, clean_lines, linenum, error): argument
4251 line = clean_lines.elided[linenum]
4269 error(filename, linenum, 'readability/alt_tokens', 2,
4296 def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, argument
4318 line = raw_lines[linenum]
4319 prev = raw_lines[linenum - 1] if linenum > 0 else ''
4322 error(filename, linenum, 'whitespace/tab', 1,
4340 cleansed_line = clean_lines.elided[linenum]
4351 not (clean_lines.raw_lines[linenum] != line and
4353 error(filename, linenum, 'whitespace/indent', 3,
4358 error(filename, linenum, 'whitespace/end_of_line', 4,
4383 error(filename, linenum, 'whitespace/line_length', 2,
4389 (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or
4390 GetPreviousNonBlankLine(clean_lines, linenum)[0].find(';') != -1) and
4395 error(filename, linenum, 'whitespace/newline', 0,
4399 CheckBraces(filename, clean_lines, linenum, error)
4400 CheckTrailingSemicolon(filename, clean_lines, linenum, error)
4401 CheckEmptyBlockBody(filename, clean_lines, linenum, error)
4402 CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
4403 CheckOperatorSpacing(filename, clean_lines, linenum, error)
4404 CheckParenthesisSpacing(filename, clean_lines, linenum, error)
4405 CheckCommaSpacing(filename, clean_lines, linenum, error)
4406 CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error)
4407 CheckSpacingForFunctionCall(filename, clean_lines, linenum, error)
4408 CheckCheck(filename, clean_lines, linenum, error)
4409 CheckAltTokens(filename, clean_lines, linenum, error)
4412 CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
4511 def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): argument
4526 line = clean_lines.lines[linenum]
4537 error(filename, linenum, 'build/include', 4,
4549 error(filename, linenum, 'build/include', 4,
4554 error(filename, linenum, 'build/include', 4,
4557 include_state.include_list[-1].append((include, linenum))
4573 error(filename, linenum, 'build/include_order', 4,
4578 clean_lines, linenum, canonical_include):
4579 error(filename, linenum, 'build/include_alpha', 4,
4670 def CheckLanguage(filename, clean_lines, linenum, file_extension, argument
4689 line = clean_lines.elided[linenum]
4695 CheckIncludeLine(filename, clean_lines, linenum, include_state, error)
4708 CheckCasts(filename, clean_lines, linenum, error)
4709 CheckGlobalStatic(filename, clean_lines, linenum, error)
4710 CheckPrintf(filename, clean_lines, linenum, error)
4724 error(filename, linenum, 'runtime/int', 4,
4729 error(filename, linenum, 'runtime/int', 4,
4739 error(filename, linenum, 'runtime/operator', 4,
4745 error(filename, linenum, 'readability/braces', 4,
4761 error(filename, linenum, 'runtime/printf', 4,
4768 error(filename, linenum, 'runtime/memset', 4,
4773 error(filename, linenum, 'build/namespaces', 5,
4812 error(filename, linenum, 'runtime/arrays', 1,
4822 error(filename, linenum, 'build/namespaces', 4,
4828 def CheckGlobalStatic(filename, clean_lines, linenum, error): argument
4837 line = clean_lines.elided[linenum]
4840 if linenum + 1 < clean_lines.NumLines() and not Search(r'[;({]', line):
4841 line += clean_lines.elided[linenum + 1].strip()
4875 error(filename, linenum, 'runtime/string', 4,
4880 error(filename, linenum, 'runtime/string', 4,
4885 error(filename, linenum, 'runtime/init', 4,
4889 def CheckPrintf(filename, clean_lines, linenum, error): argument
4898 line = clean_lines.elided[linenum]
4904 error(filename, linenum, 'runtime/printf', 3,
4910 error(filename, linenum, 'runtime/printf', 5,
4914 error(filename, linenum, 'runtime/printf', 4,
4918 def IsDerivedFunction(clean_lines, linenum): argument
4929 for i in xrange(linenum, max(-1, linenum - 10), -1):
4940 def IsOutOfLineMethodDefinition(clean_lines, linenum): argument
4950 for i in xrange(linenum, max(-1, linenum - 10), -1):
4956 def IsInitializerList(clean_lines, linenum): argument
4966 for i in xrange(linenum, 1, -1):
4968 if i == linenum:
4998 def CheckForNonConstReference(filename, clean_lines, linenum, argument
5014 line = clean_lines.elided[linenum]
5021 if IsDerivedFunction(clean_lines, linenum):
5026 if IsOutOfLineMethodDefinition(clean_lines, linenum):
5045 if linenum > 1:
5050 clean_lines.elided[linenum - 1])
5054 clean_lines.elided[linenum - 1])
5062 clean_lines, linenum, endpos)
5063 if startpos > -1 and startline < linenum:
5067 for i in xrange(startline, linenum + 1):
5090 if linenum > 0:
5091 for i in xrange(linenum - 1, max(0, linenum - 10), -1):
5103 if IsInitializerList(clean_lines, linenum):
5123 if (linenum > i and
5124 Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
5131 error(filename, linenum, 'runtime/references', 2,
5137 def CheckCasts(filename, clean_lines, linenum, error): argument
5146 line = clean_lines.elided[linenum]
5156 expecting_function = ExpectingFunctionArgs(clean_lines, linenum)
5192 error(filename, linenum, 'readability/casting', 4,
5198 CheckCStyleCast(filename, clean_lines, linenum, 'static_cast',
5205 if CheckCStyleCast(filename, clean_lines, linenum, 'const_cast',
5210 CheckCStyleCast(filename, clean_lines, linenum, 'reinterpret_cast',
5234 _, y1, x1 = CloseExpression(clean_lines, linenum, len(match.group(1)))
5245 error(filename, linenum, 'readability/casting', 4,
5250 error(filename, linenum, 'runtime/casting', 4,
5256 def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error): argument
5272 line = clean_lines.elided[linenum]
5284 if linenum > 0:
5285 for i in xrange(linenum - 1, max(0, linenum - 5), -1):
5302 error(filename, linenum, 'readability/casting', 4,
5309 def ExpectingFunctionArgs(clean_lines, linenum): argument
5320 line = clean_lines.elided[linenum]
5322 (linenum >= 2 and
5324 clean_lines.elided[linenum - 1]) or
5326 clean_lines.elided[linenum - 2]) or
5328 clean_lines.elided[linenum - 1]))))
5472 linenum = 0
5474 linenum += 1
5479 include_dict.setdefault(include, linenum)
5504 for linenum in xrange(clean_lines.NumLines()):
5505 line = clean_lines.elided[linenum]
5516 required['<string>'] = (linenum, 'string')
5520 required[header] = (linenum, template)
5533 required[header] = (linenum, template)
5585 def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error): argument
5597 line = clean_lines.elided[linenum]
5600 error(filename, linenum, 'build/explicit_make_pair',
5606 def CheckRedundantVirtual(filename, clean_lines, linenum, error): argument
5616 line = clean_lines.elided[linenum]
5640 for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())):
5659 error(filename, linenum, 'readability/inheritance', 4,
5670 def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error): argument
5682 line = clean_lines.elided[linenum]
5687 if linenum > 1 and clean_lines.elided[linenum - 1].rfind(')') >= 0:
5694 error(filename, linenum, 'readability/inheritance', 4,
5725 raw_lines_no_comments, linenum): argument
5742 linenum)
5748 if IsMacroDefinition(raw_lines_no_comments, linenum):
5757 def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum, argument
5759 line = raw_lines_no_comments[linenum]
5761 error(filename, linenum, 'runtime/indentation_namespace', 4,
5809 def FlagCxx11Features(filename, clean_lines, linenum, error): argument
5818 line = clean_lines.elided[linenum]
5824 error(filename, linenum, 'build/c++tr1', 5,
5839 error(filename, linenum, 'build/c++11', 5,
5855 error(filename, linenum, 'build/c++11', 5,
5861 def FlagCxx14Features(filename, clean_lines, linenum, error): argument
5870 line = clean_lines.elided[linenum]
5876 error(filename, linenum, 'build/c++14', 5,
6058 for linenum in range(len(lines) - 1):
6059 if lines[linenum].endswith('\r'):
6060 lines[linenum] = lines[linenum].rstrip('\r')
6061 crlf_lines.append(linenum + 1)
6063 lf_lines.append(linenum + 1)
6097 for linenum in crlf_lines:
6098 Error(filename, linenum, 'whitespace/newline', 1,