Code Duplication    Length = 29-29 lines in 2 locations

core/build-support/cpplint.py 1 location

@@ 1955-1983 (lines=29) @@
1952
    return 0
1953
1954
1955
def GetHeaderGuardCPPVariable(filename):
1956
  """Returns the CPP variable that should be used as a header guard.
1957
1958
  Args:
1959
    filename: The name of a C++ header file.
1960
1961
  Returns:
1962
    The CPP variable that should be used as a header guard in the
1963
    named file.
1964
1965
  """
1966
1967
  # Restores original filename in case that cpplint is invoked from Emacs's
1968
  # flymake.
1969
  filename = re.sub(r'_flymake\.h$', '.h', filename)
1970
  filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
1971
  # Replace 'c++' with 'cpp'.
1972
  filename = filename.replace('C++', 'cpp').replace('c++', 'cpp')
1973
1974
  fileinfo = FileInfo(filename)
1975
  file_path_from_root = fileinfo.RepositoryName()
1976
  if _root:
1977
    suffix = os.sep
1978
    # On Windows using directory separator will leave us with
1979
    # "bogus escape error" unless we properly escape regex.
1980
    if suffix == '\\':
1981
      suffix += '\\'
1982
    file_path_from_root = re.sub('^' + _root + suffix, '', file_path_from_root)
1983
  return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_'
1984
1985
1986
def CheckForHeaderGuard(filename, clean_lines, error):

sdk/build-support/cpplint.py 1 location

@@ 1955-1983 (lines=29) @@
1952
    return 0
1953
1954
1955
def GetHeaderGuardCPPVariable(filename):
1956
  """Returns the CPP variable that should be used as a header guard.
1957
1958
  Args:
1959
    filename: The name of a C++ header file.
1960
1961
  Returns:
1962
    The CPP variable that should be used as a header guard in the
1963
    named file.
1964
1965
  """
1966
1967
  # Restores original filename in case that cpplint is invoked from Emacs's
1968
  # flymake.
1969
  filename = re.sub(r'_flymake\.h$', '.h', filename)
1970
  filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
1971
  # Replace 'c++' with 'cpp'.
1972
  filename = filename.replace('C++', 'cpp').replace('c++', 'cpp')
1973
1974
  fileinfo = FileInfo(filename)
1975
  file_path_from_root = fileinfo.RepositoryName()
1976
  if _root:
1977
    suffix = os.sep
1978
    # On Windows using directory separator will leave us with
1979
    # "bogus escape error" unless we properly escape regex.
1980
    if suffix == '\\':
1981
      suffix += '\\'
1982
    file_path_from_root = re.sub('^' + _root + suffix, '', file_path_from_root)
1983
  return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_'
1984
1985
1986
def CheckForHeaderGuard(filename, clean_lines, error):