MCPcopy Index your code
hub / github.com/cpplint/cpplint / ProcessFileData

Function ProcessFileData

cpplint.py:7355–7424  ·  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

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

Source from the content-addressed store, hash-verified

7353
7354
7355def ProcessFileData(filename, file_extension, lines, error, extra_check_functions=None):
7356 """Performs lint checks and reports any errors to the given error function.
7357
7358 Args:
7359 filename: Filename of the file that is being processed.
7360 file_extension: The extension (dot not included) of the file.
7361 lines: An array of strings, each representing a line of the file, with the
7362 last element being empty if the file is terminated with a newline.
7363 error: A callable to which errors are reported, which takes 4 arguments:
7364 filename, line number, error level, and message
7365 extra_check_functions: An array of additional check functions that will be
7366 run on each source line. Each function takes 4
7367 arguments: filename, clean_lines, line, error
7368 """
7369 lines = (
7370 ["// marker so line numbers and indices both start at 1"]
7371 + lines
7372 + ["// marker so line numbers end in a known way"]
7373 )
7374
7375 include_state = _IncludeState()
7376 function_state = _FunctionState()
7377 nesting_state = NestingState()
7378
7379 ResetNolintSuppressions()
7380
7381 CheckForCopyright(filename, lines, error)
7382 ProcessGlobalSuppressions(filename, lines)
7383 RemoveMultiLineComments(filename, lines, error)
7384 clean_lines = CleansedLines(lines)
7385
7386 cppvar = None
7387 if IsHeaderExtension(file_extension):
7388 cppvar = GetHeaderGuardCPPVariable(filename)
7389 CheckForHeaderGuard(filename, clean_lines, error, cppvar)
7390
7391 for line in range(clean_lines.NumLines()):
7392 ProcessLine(
7393 filename,
7394 file_extension,
7395 clean_lines,
7396 line,
7397 include_state,
7398 function_state,
7399 nesting_state,
7400 error,
7401 extra_check_functions,
7402 cppvar,
7403 )
7404 FlagCxxHeaders(filename, clean_lines, line, error)
7405 if _error_suppressions.HasOpenBlock():
7406 error(
7407 filename,
7408 _error_suppressions.GetOpenBlockStart(),
7409 "readability/nolint",
7410 5,
7411 "NONLINT block never ended",
7412 )

Callers 1

ProcessFileFunction · 0.85

Calls 15

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

Tested by

no test coverage detected