Code Duplication    Length = 34-34 lines in 2 locations

core/build-support/cpplint.py 1 location

@@ 2159-2192 (lines=34) @@
2156
          'Could not find a newline character at the end of the file.')
2157
2158
2159
def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
2160
  """Logs an error if we see /* ... */ or "..." that extend past one line.
2161
2162
  /* ... */ comments are legit inside macros, for one line.
2163
  Otherwise, we prefer // comments, so it's ok to warn about the
2164
  other.  Likewise, it's ok for strings to extend across multiple
2165
  lines, as long as a line continuation character (backslash)
2166
  terminates each line. Although not currently prohibited by the C++
2167
  style guide, it's ugly and unnecessary. We don't do well with either
2168
  in this lint program, so we warn about both.
2169
2170
  Args:
2171
    filename: The name of the current file.
2172
    clean_lines: A CleansedLines instance containing the file.
2173
    linenum: The number of the line to check.
2174
    error: The function to call with any errors found.
2175
  """
2176
  line = clean_lines.elided[linenum]
2177
2178
  # Remove all \\ (escaped backslashes) from the line. They are OK, and the
2179
  # second (escaped) slash may trigger later \" detection erroneously.
2180
  line = line.replace('\\\\', '')
2181
2182
  if line.count('/*') > line.count('*/'):
2183
    error(filename, linenum, 'readability/multiline_comment', 5,
2184
          'Complex multi-line /*...*/-style comment found. '
2185
          'Lint may give bogus warnings.  '
2186
          'Consider replacing these with //-style comments, '
2187
          'with #if 0...#endif, '
2188
          'or with more clearly structured multi-line comments.')
2189
2190
  if (line.count('"') - line.count('\\"')) % 2:
2191
    error(filename, linenum, 'readability/multiline_string', 5,
2192
          'Multi-line string ("...") found.  This lint script doesn\'t '
2193
          'do well with such strings, and may give bogus warnings.  '
2194
          'Use C++11 raw strings or concatenation instead.')
2195

sdk/build-support/cpplint.py 1 location

@@ 2159-2192 (lines=34) @@
2156
          'Could not find a newline character at the end of the file.')
2157
2158
2159
def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
2160
  """Logs an error if we see /* ... */ or "..." that extend past one line.
2161
2162
  /* ... */ comments are legit inside macros, for one line.
2163
  Otherwise, we prefer // comments, so it's ok to warn about the
2164
  other.  Likewise, it's ok for strings to extend across multiple
2165
  lines, as long as a line continuation character (backslash)
2166
  terminates each line. Although not currently prohibited by the C++
2167
  style guide, it's ugly and unnecessary. We don't do well with either
2168
  in this lint program, so we warn about both.
2169
2170
  Args:
2171
    filename: The name of the current file.
2172
    clean_lines: A CleansedLines instance containing the file.
2173
    linenum: The number of the line to check.
2174
    error: The function to call with any errors found.
2175
  """
2176
  line = clean_lines.elided[linenum]
2177
2178
  # Remove all \\ (escaped backslashes) from the line. They are OK, and the
2179
  # second (escaped) slash may trigger later \" detection erroneously.
2180
  line = line.replace('\\\\', '')
2181
2182
  if line.count('/*') > line.count('*/'):
2183
    error(filename, linenum, 'readability/multiline_comment', 5,
2184
          'Complex multi-line /*...*/-style comment found. '
2185
          'Lint may give bogus warnings.  '
2186
          'Consider replacing these with //-style comments, '
2187
          'with #if 0...#endif, '
2188
          'or with more clearly structured multi-line comments.')
2189
2190
  if (line.count('"') - line.count('\\"')) % 2:
2191
    error(filename, linenum, 'readability/multiline_string', 5,
2192
          'Multi-line string ("...") found.  This lint script doesn\'t '
2193
          'do well with such strings, and may give bogus warnings.  '
2194
          'Use C++11 raw strings or concatenation instead.')
2195