MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / FindCheckMacro

Function FindCheckMacro

src/tests/coding/cpplint.py:4602–4622  ·  view source on GitHub ↗

Find a replaceable CHECK-like macro. Args: line: line to search on. Returns: (macro name, start position), or (None, -1) if no replaceable macro is found.

(line)

Source from the content-addressed store, hash-verified

4600
4601
4602def FindCheckMacro(line):
4603 """Find a replaceable CHECK-like macro.
4604
4605 Args:
4606 line: line to search on.
4607 Returns:
4608 (macro name, start position), or (None, -1) if no replaceable
4609 macro is found.
4610 """
4611 for macro in _CHECK_MACROS:
4612 i = line.find(macro)
4613 if i >= 0:
4614 # Find opening parenthesis. Do a regular expression match here
4615 # to make sure that we are matching the expected CHECK macro, as
4616 # opposed to some other macro that happens to contain the CHECK
4617 # substring.
4618 matched = Match(r'^(.*\b' + macro + r'\s*)\(', line)
4619 if not matched:
4620 continue
4621 return (macro, len(matched.group(1)))
4622 return (None, -1)
4623
4624
4625def CheckCheck(filename, clean_lines, linenum, error):

Callers 1

CheckCheckFunction · 0.85

Calls 3

MatchFunction · 0.70
findMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected