MCPcopy Index your code
hub / github.com/tensorflow/tfjs / ProcessFileData

Function ProcessFileData

tfjs-backend-wasm/tools/cpplint.py:5895–5944  ·  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=[])

Source from the content-addressed store, hash-verified

5893
5894
5895def ProcessFileData(filename, file_extension, lines, error,
5896 extra_check_functions=[]):
5897 """Performs lint checks and reports any errors to the given error function.
5898
5899 Args:
5900 filename: Filename of the file that is being processed.
5901 file_extension: The extension (dot not included) of the file.
5902 lines: An array of strings, each representing a line of the file, with the
5903 last element being empty if the file is terminated with a newline.
5904 error: A callable to which errors are reported, which takes 4 arguments:
5905 filename, line number, error level, and message
5906 extra_check_functions: An array of additional check functions that will be
5907 run on each source line. Each function takes 4
5908 arguments: filename, clean_lines, line, error
5909 """
5910 lines = (['// marker so line numbers and indices both start at 1'] + lines +
5911 ['// marker so line numbers end in a known way'])
5912
5913 include_state = _IncludeState()
5914 function_state = _FunctionState()
5915 nesting_state = NestingState()
5916
5917 ResetNolintSuppressions()
5918
5919 CheckForCopyright(filename, lines, error)
5920 ProcessGlobalSuppresions(lines)
5921 RemoveMultiLineComments(filename, lines, error)
5922 clean_lines = CleansedLines(lines)
5923
5924 if IsHeaderExtension(file_extension):
5925 CheckForHeaderGuard(filename, clean_lines, error)
5926
5927 for line in xrange(clean_lines.NumLines()):
5928 ProcessLine(filename, file_extension, clean_lines, line,
5929 include_state, function_state, nesting_state, error,
5930 extra_check_functions)
5931 FlagCxx11Features(filename, clean_lines, line, error)
5932 nesting_state.CheckCompletedBlocks(filename, error)
5933
5934 CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
5935
5936 # Check that the .cc file has included its header if it exists.
5937 if _IsSourceExtension(file_extension):
5938 CheckHeaderFileIncluded(filename, include_state, error)
5939
5940 # We check here rather than inside ProcessLine so that we see raw
5941 # lines rather than "cleaned" lines.
5942 CheckForBadCharacters(filename, lines, error)
5943
5944 CheckForNewlineAtEOF(filename, lines, error)
5945
5946def ProcessConfigOverrides(filename):
5947 """ 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…