MCPcopy Create free account
hub / github.com/apache/mesos / CleanseComments

Function CleanseComments

support/cpplint.py:1413–1426  ·  view source on GitHub ↗

Removes //-comments and single-line C-style /* */ comments. Args: line: A line of C++ source. Returns: The line with single-line comments removed.

(line)

Source from the content-addressed store, hash-verified

1411
1412
1413def CleanseComments(line):
1414 """Removes //-comments and single-line C-style /* */ comments.
1415
1416 Args:
1417 line: A line of C++ source.
1418
1419 Returns:
1420 The line with single-line comments removed.
1421 """
1422 commentpos = line.find('//')
1423 if commentpos != -1 and not IsCppString(line[:commentpos]):
1424 line = line[:commentpos].rstrip()
1425 # get rid of /* ... */
1426 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1427
1428
1429class CleansedLines(object):

Callers 3

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85
UpdateIncludeStateFunction · 0.85

Calls 2

IsCppStringFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected