MCPcopy Create free account
hub / github.com/BVLC/caffe / ProcessFileData

Function ProcessFileData

scripts/cpp_lint.py:4648–4691  ·  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

4646 check_fn(filename, clean_lines, line, error)
4647
4648def ProcessFileData(filename, file_extension, lines, error,
4649 extra_check_functions=[]):
4650 """Performs lint checks and reports any errors to the given error function.
4651
4652 Args:
4653 filename: Filename of the file that is being processed.
4654 file_extension: The extension (dot not included) of the file.
4655 lines: An array of strings, each representing a line of the file, with the
4656 last element being empty if the file is terminated with a newline.
4657 error: A callable to which errors are reported, which takes 4 arguments:
4658 filename, line number, error level, and message
4659 extra_check_functions: An array of additional check functions that will be
4660 run on each source line. Each function takes 4
4661 arguments: filename, clean_lines, line, error
4662 """
4663 lines = (['// marker so line numbers and indices both start at 1'] + lines +
4664 ['// marker so line numbers end in a known way'])
4665
4666 include_state = _IncludeState()
4667 function_state = _FunctionState()
4668 nesting_state = _NestingState()
4669
4670 ResetNolintSuppressions()
4671
4672 CheckForCopyright(filename, lines, error)
4673
4674 if file_extension == 'h':
4675 CheckForHeaderGuard(filename, lines, error)
4676
4677 RemoveMultiLineComments(filename, lines, error)
4678 clean_lines = CleansedLines(lines)
4679 for line in xrange(clean_lines.NumLines()):
4680 ProcessLine(filename, file_extension, clean_lines, line,
4681 include_state, function_state, nesting_state, error,
4682 extra_check_functions)
4683 nesting_state.CheckCompletedBlocks(filename, error)
4684
4685 CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
4686
4687 # We check here rather than inside ProcessLine so that we see raw
4688 # lines rather than "cleaned" lines.
4689 CheckForBadCharacters(filename, lines, error)
4690
4691 CheckForNewlineAtEOF(filename, lines, error)
4692
4693def ProcessFile(filename, vlevel, extra_check_functions=[]):
4694 """Does google-lint on a single file.

Callers 1

ProcessFileFunction · 0.85

Calls 14

NumLinesMethod · 0.95
_IncludeStateClass · 0.85
_FunctionStateClass · 0.85
_NestingStateClass · 0.85
ResetNolintSuppressionsFunction · 0.85
CheckForCopyrightFunction · 0.85
CheckForHeaderGuardFunction · 0.85
RemoveMultiLineCommentsFunction · 0.85
CleansedLinesClass · 0.85
ProcessLineFunction · 0.85
CheckForBadCharactersFunction · 0.85

Tested by

no test coverage detected