MCPcopy Index your code
hub / github.com/cpplint/cpplint / _UpdateNamesapce

Method _UpdateNamesapce

cpplint.py:3429–3454  ·  view source on GitHub ↗

Match start of namespace, append to stack, and consume line Args: line: Line to check and consume linenum: Line number of the line to check Returns: The consumed line if namespace matched; None otherwise

(self, line: str, linenum: int)

Source from the content-addressed store, hash-verified

3427 inner_block.inline_asm = _END_ASM
3428
3429 def _UpdateNamesapce(self, line: str, linenum: int) -> str | None:
3430 """
3431 Match start of namespace, append to stack, and consume line
3432 Args:
3433 line: Line to check and consume
3434 linenum: Line number of the line to check
3435
3436 Returns:
3437 The consumed line if namespace matched; None otherwise
3438 """
3439 # Match start of namespace. The "\b\s*" below catches namespace
3440 # declarations even if it weren't followed by a whitespace, this
3441 # is so that we don't confuse our namespace checker. The
3442 # missing spaces will be flagged by CheckSpacing.
3443 namespace_decl_match = re.match(r"^\s*namespace\b\s*([:\w]+)?(.*)$", line)
3444 if not namespace_decl_match:
3445 return None
3446
3447 new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
3448 self.stack.append(new_namespace)
3449
3450 line = namespace_decl_match.group(2)
3451 if line.find("{") != -1:
3452 new_namespace.seen_open_brace = True
3453 line = line[line.find("{") + 1 :]
3454 return line
3455
3456 def _UpdateConstructor(self, line: str, linenum: int, class_name: str | None = None):
3457 """

Callers 1

UpdateMethod · 0.95

Calls 1

_NamespaceInfoClass · 0.85

Tested by

no test coverage detected