MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / ProcessFileData

Function ProcessFileData

Tools/cpplint.py:5820–5869  ·  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

5818
5819
5820def ProcessFileData(filename, file_extension, lines, error,
5821 extra_check_functions=[]):
5822 """Performs lint checks and reports any errors to the given error function.
5823
5824 Args:
5825 filename: Filename of the file that is being processed.
5826 file_extension: The extension (dot not included) of the file.
5827 lines: An array of strings, each representing a line of the file, with the
5828 last element being empty if the file is terminated with a newline.
5829 error: A callable to which errors are reported, which takes 4 arguments:
5830 filename, line number, error level, and message
5831 extra_check_functions: An array of additional check functions that will be
5832 run on each source line. Each function takes 4
5833 arguments: filename, clean_lines, line, error
5834 """
5835 lines = (['// marker so line numbers and indices both start at 1'] + lines +
5836 ['// marker so line numbers end in a known way'])
5837
5838 include_state = _IncludeState()
5839 function_state = _FunctionState()
5840 nesting_state = NestingState()
5841
5842 ResetNolintSuppressions()
5843
5844 CheckForCopyright(filename, lines, error)
5845 ProcessGlobalSuppresions(lines)
5846 RemoveMultiLineComments(filename, lines, error)
5847 clean_lines = CleansedLines(lines)
5848
5849 if IsHeaderExtension(file_extension):
5850 CheckForHeaderGuard(filename, clean_lines, error)
5851
5852 for line in xrange(clean_lines.NumLines()):
5853 ProcessLine(filename, file_extension, clean_lines, line,
5854 include_state, function_state, nesting_state, error,
5855 extra_check_functions)
5856 FlagCxx11Features(filename, clean_lines, line, error)
5857 nesting_state.CheckCompletedBlocks(filename, error)
5858
5859 CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
5860
5861 # Check that the .cc file has included its header if it exists.
5862 if _IsSourceExtension(file_extension):
5863 CheckHeaderFileIncluded(filename, include_state, error)
5864
5865 # We check here rather than inside ProcessLine so that we see raw
5866 # lines rather than "cleaned" lines.
5867 CheckForBadCharacters(filename, lines, error)
5868
5869 CheckForNewlineAtEOF(filename, lines, error)
5870
5871def ProcessConfigOverrides(filename):
5872 """ 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