MCPcopy Create free account
hub / github.com/alibaba/GraphScope / FindCheckMacro

Function FindCheckMacro

analytical_engine/misc/cpplint.py:4605–4625  ·  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

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

Callers 1

CheckCheckFunction · 0.85

Calls 3

findMethod · 0.80
MatchFunction · 0.70
groupMethod · 0.45

Tested by

no test coverage detected