MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / ProcessFileData

Function ProcessFileData

steps/cpplint.py:6463–6512  ·  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

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