MCPcopy Create free account
hub / github.com/alibaba/GraphScope / ProcessFileData

Function ProcessFileData

analytical_engine/misc/cpplint.py:6454–6503  ·  view source on GitHub ↗

Performs lint checks and reports any errors to the given error function. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. lines: An array of strings, each representing a line of the file, with the la

(filename, file_extension, lines, error,
                    extra_check_functions=None)

Source from the content-addressed store, hash-verified

6452
6453
6454def ProcessFileData(filename, file_extension, lines, error,
6455 extra_check_functions=None):
6456 """Performs lint checks and reports any errors to the given error function.
6457
6458 Args:
6459 filename: Filename of the file that is being processed.
6460 file_extension: The extension (dot not included) of the file.
6461 lines: An array of strings, each representing a line of the file, with the
6462 last element being empty if the file is terminated with a newline.
6463 error: A callable to which errors are reported, which takes 4 arguments:
6464 filename, line number, error level, and message
6465 extra_check_functions: An array of additional check functions that will be
6466 run on each source line. Each function takes 4
6467 arguments: filename, clean_lines, line, error
6468 """
6469 lines = (['// marker so line numbers and indices both start at 1'] + lines +
6470 ['// marker so line numbers end in a known way'])
6471
6472 include_state = _IncludeState()
6473 function_state = _FunctionState()
6474 nesting_state = NestingState()
6475
6476 ResetNolintSuppressions()
6477
6478 CheckForCopyright(filename, lines, error)
6479 ProcessGlobalSuppresions(lines)
6480 RemoveMultiLineComments(filename, lines, error)
6481 clean_lines = CleansedLines(lines)
6482
6483 if IsHeaderExtension(file_extension):
6484 CheckForHeaderGuard(filename, clean_lines, error)
6485
6486 for line in xrange(clean_lines.NumLines()):
6487 ProcessLine(filename, file_extension, clean_lines, line,
6488 include_state, function_state, nesting_state, error,
6489 extra_check_functions)
6490 FlagCxx11Features(filename, clean_lines, line, error)
6491 nesting_state.CheckCompletedBlocks(filename, error)
6492
6493 CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
6494
6495 # Check that the .cc file has included its header if it exists.
6496 if _IsSourceExtension(file_extension):
6497 CheckHeaderFileIncluded(filename, include_state, error)
6498
6499 # We check here rather than inside ProcessLine so that we see raw
6500 # lines rather than "cleaned" lines.
6501 CheckForBadCharacters(filename, lines, error)
6502
6503 CheckForNewlineAtEOF(filename, lines, error)
6504
6505def ProcessConfigOverrides(filename):
6506 """ Loads the configuration files and processes the config overrides.

Callers 1

ProcessFileFunction · 0.85

Calls 15

NumLinesMethod · 0.95
CheckCompletedBlocksMethod · 0.95
_IncludeStateClass · 0.85
_FunctionStateClass · 0.85
NestingStateClass · 0.85
ResetNolintSuppressionsFunction · 0.85
CheckForCopyrightFunction · 0.85
ProcessGlobalSuppresionsFunction · 0.85
RemoveMultiLineCommentsFunction · 0.85
CleansedLinesClass · 0.85
IsHeaderExtensionFunction · 0.85
CheckForHeaderGuardFunction · 0.85

Tested by

no test coverage detected