MCPcopy Create free account
hub / github.com/alibaba/graph-learn / ProcessFileData

Function ProcessFileData

dynamic_graph_service/ci/cpplint.py:6159–6208  ·  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

6157
6158
6159def ProcessFileData(filename, file_extension, lines, error,
6160 extra_check_functions=None):
6161 """Performs lint checks and reports any errors to the given error function.
6162
6163 Args:
6164 filename: Filename of the file that is being processed.
6165 file_extension: The extension (dot not included) of the file.
6166 lines: An array of strings, each representing a line of the file, with the
6167 last element being empty if the file is terminated with a newline.
6168 error: A callable to which errors are reported, which takes 4 arguments:
6169 filename, line number, error level, and message
6170 extra_check_functions: An array of additional check functions that will be
6171 run on each source line. Each function takes 4
6172 arguments: filename, clean_lines, line, error
6173 """
6174 lines = (['// marker so line numbers and indices both start at 1'] + lines +
6175 ['// marker so line numbers end in a known way'])
6176
6177 include_state = _IncludeState()
6178 function_state = _FunctionState()
6179 nesting_state = NestingState()
6180
6181 ResetNolintSuppressions()
6182
6183 CheckForCopyright(filename, lines, error)
6184 ProcessGlobalSuppresions(lines)
6185 RemoveMultiLineComments(filename, lines, error)
6186 clean_lines = CleansedLines(lines)
6187
6188 if IsHeaderExtension(file_extension):
6189 CheckForHeaderGuard(filename, clean_lines, error)
6190
6191 for line in xrange(clean_lines.NumLines()):
6192 ProcessLine(filename, file_extension, clean_lines, line,
6193 include_state, function_state, nesting_state, error,
6194 extra_check_functions)
6195 FlagCxx11Features(filename, clean_lines, line, error)
6196 nesting_state.CheckCompletedBlocks(filename, error)
6197
6198 CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
6199
6200 # Check that the .cc file has included its header if it exists.
6201 if _IsSourceExtension(file_extension):
6202 CheckHeaderFileIncluded(filename, include_state, error)
6203
6204 # We check here rather than inside ProcessLine so that we see raw
6205 # lines rather than "cleaned" lines.
6206 CheckForBadCharacters(filename, lines, error)
6207
6208 CheckForNewlineAtEOF(filename, lines, error)
6209
6210def ProcessConfigOverrides(filename):
6211 """ 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