Code Duplication    Length = 23-23 lines in 2 locations

core/build-support/cpplint.py 1 location

@@ 2116-2138 (lines=23) @@
2113
                                                      headername))
2114
2115
2116
def CheckForBadCharacters(filename, lines, error):
2117
  """Logs an error for each line containing bad characters.
2118
2119
  Two kinds of bad characters:
2120
2121
  1. Unicode replacement characters: These indicate that either the file
2122
  contained invalid UTF-8 (likely) or Unicode replacement characters (which
2123
  it shouldn't).  Note that it's possible for this to throw off line
2124
  numbering if the invalid UTF-8 occurred adjacent to a newline.
2125
2126
  2. NUL bytes.  These are problematic for some tools.
2127
2128
  Args:
2129
    filename: The name of the current file.
2130
    lines: An array of strings, each representing a line of the file.
2131
    error: The function to call with any errors found.
2132
  """
2133
  for linenum, line in enumerate(lines):
2134
    if unicode_escape_decode('\ufffd') in line:
2135
      error(filename, linenum, 'readability/utf8', 5,
2136
            'Line contains invalid UTF-8 (or Unicode replacement character).')
2137
    if '\0' in line:
2138
      error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')
2139
2140
2141
def CheckForNewlineAtEOF(filename, lines, error):

sdk/build-support/cpplint.py 1 location

@@ 2116-2138 (lines=23) @@
2113
                                                      headername))
2114
2115
2116
def CheckForBadCharacters(filename, lines, error):
2117
  """Logs an error for each line containing bad characters.
2118
2119
  Two kinds of bad characters:
2120
2121
  1. Unicode replacement characters: These indicate that either the file
2122
  contained invalid UTF-8 (likely) or Unicode replacement characters (which
2123
  it shouldn't).  Note that it's possible for this to throw off line
2124
  numbering if the invalid UTF-8 occurred adjacent to a newline.
2125
2126
  2. NUL bytes.  These are problematic for some tools.
2127
2128
  Args:
2129
    filename: The name of the current file.
2130
    lines: An array of strings, each representing a line of the file.
2131
    error: The function to call with any errors found.
2132
  """
2133
  for linenum, line in enumerate(lines):
2134
    if unicode_escape_decode('\ufffd') in line:
2135
      error(filename, linenum, 'readability/utf8', 5,
2136
            'Line contains invalid UTF-8 (or Unicode replacement character).')
2137
    if '\0' in line:
2138
      error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')
2139
2140
2141
def CheckForNewlineAtEOF(filename, lines, error):