MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / FindCheckMacro

Function FindCheckMacro

steps/cpplint.py:4615–4635  ·  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

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

Callers 1

CheckCheckFunction · 0.85

Calls 1

MatchFunction · 0.85

Tested by

no test coverage detected