Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. clean_lines: An array of strings, each representing a line of the file, with comments stripped. line: N
(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
extra_check_functions=None)
| 6333 | |
| 6334 | |
| 6335 | def ProcessLine(filename, file_extension, clean_lines, line, |
| 6336 | include_state, function_state, nesting_state, error, |
| 6337 | extra_check_functions=None): |
| 6338 | """Processes a single line in the file. |
| 6339 | |
| 6340 | Args: |
| 6341 | filename: Filename of the file that is being processed. |
| 6342 | file_extension: The extension (dot not included) of the file. |
| 6343 | clean_lines: An array of strings, each representing a line of the file, |
| 6344 | with comments stripped. |
| 6345 | line: Number of line being processed. |
| 6346 | include_state: An _IncludeState instance in which the headers are inserted. |
| 6347 | function_state: A _FunctionState instance which counts function lines, etc. |
| 6348 | nesting_state: A NestingState instance which maintains information about |
| 6349 | the current stack of nested blocks being parsed. |
| 6350 | error: A callable to which errors are reported, which takes 4 arguments: |
| 6351 | filename, line number, error level, and message |
| 6352 | extra_check_functions: An array of additional check functions that will be |
| 6353 | run on each source line. Each function takes 4 |
| 6354 | arguments: filename, clean_lines, line, error |
| 6355 | """ |
| 6356 | raw_lines = clean_lines.raw_lines |
| 6357 | ParseNolintSuppressions(filename, raw_lines[line], line, error) |
| 6358 | nesting_state.Update(filename, clean_lines, line, error) |
| 6359 | CheckForNamespaceIndentation(filename, nesting_state, clean_lines, line, |
| 6360 | error) |
| 6361 | if nesting_state.InAsmBlock(): return |
| 6362 | CheckForFunctionLengths(filename, clean_lines, line, function_state, error) |
| 6363 | CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error) |
| 6364 | CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error) |
| 6365 | CheckLanguage(filename, clean_lines, line, file_extension, include_state, |
| 6366 | nesting_state, error) |
| 6367 | CheckForNonConstReference(filename, clean_lines, line, nesting_state, error) |
| 6368 | CheckForNonStandardConstructs(filename, clean_lines, line, |
| 6369 | nesting_state, error) |
| 6370 | CheckVlogArguments(filename, clean_lines, line, error) |
| 6371 | CheckPosixThreading(filename, clean_lines, line, error) |
| 6372 | CheckInvalidIncrement(filename, clean_lines, line, error) |
| 6373 | CheckMakePairUsesDeduction(filename, clean_lines, line, error) |
| 6374 | CheckRedundantVirtual(filename, clean_lines, line, error) |
| 6375 | CheckRedundantOverrideOrFinal(filename, clean_lines, line, error) |
| 6376 | if extra_check_functions: |
| 6377 | for check_fn in extra_check_functions: |
| 6378 | check_fn(filename, clean_lines, line, error) |
| 6379 | |
| 6380 | def FlagCxx11Features(filename, clean_lines, linenum, error): |
| 6381 | """Flag those c++11 features that we only allow in certain places. |
no test coverage detected