How to use the cpplint._cpplint_state function in cpplint

To help you get started, we’ve selected a few cpplint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdbg / sdbg / dart / runtime / PRESUBMIT.py View on Github external
def RunLint(input_api, output_api):
  result = []
  cpplint._cpplint_state.ResetErrorCounts()
  memcpy_match_count = 0
  # Find all .cc and .h files in the change list.
  for svn_file in input_api.AffectedTextFiles():
    filename = svn_file.AbsoluteLocalPath()
    if filename.endswith('.cc') or filename.endswith('.h'):
      cleanup_parent = None
      cleanup_runtime = None
      try:
        runtime_path = input_api.PresubmitLocalPath()
        parent_path = os.path.dirname(runtime_path)
        if filename.endswith('.h'):
          cleanup_runtime = AddSvnPathIfNeeded(runtime_path)
          cleanup_parent = TrySvnPathHack(parent_path)
      except PathHackException, exception:
        return [output_api.PresubmitError(str(exception))]
      # Run cpplint on the file.