MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / ProcessFileData

Function ProcessFileData

src/tests/coding/cpplint.py:6451–6500  ·  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

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