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

Function ProcessFileData

util/cpplint.py:5817–5866  ·  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

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