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

Function ShouldCheckNamespaceIndentation

analytical_engine/misc/cpplint.py:6297–6324  ·  view source on GitHub ↗

This method determines if we should apply our namespace indentation check. Args: nesting_state: The current nesting state. is_namespace_indent_item: If we just put a new class on the stack, True. If the top of the stack is not a class, or we did not recently add the class, Fal

(nesting_state, is_namespace_indent_item,
                                    raw_lines_no_comments, linenum)

Source from the content-addressed store, hash-verified

6295
6296
6297def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
6298 raw_lines_no_comments, linenum):
6299 """This method determines if we should apply our namespace indentation check.
6300
6301 Args:
6302 nesting_state: The current nesting state.
6303 is_namespace_indent_item: If we just put a new class on the stack, True.
6304 If the top of the stack is not a class, or we did not recently
6305 add the class, False.
6306 raw_lines_no_comments: The lines without the comments.
6307 linenum: The current line number we are processing.
6308
6309 Returns:
6310 True if we should apply our namespace indentation check. Currently, it
6311 only works for classes and namespaces inside of a namespace.
6312 """
6313
6314 is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments,
6315 linenum)
6316
6317 if not (is_namespace_indent_item or is_forward_declaration):
6318 return False
6319
6320 # If we are in a macro, we do not want to check the namespace indentation.
6321 if IsMacroDefinition(raw_lines_no_comments, linenum):
6322 return False
6323
6324 return IsBlockInNameSpace(nesting_state, is_forward_declaration)
6325
6326
6327# Call this method if the line is directly inside of a namespace.

Callers 1

Calls 3

IsMacroDefinitionFunction · 0.85
IsBlockInNameSpaceFunction · 0.85

Tested by

no test coverage detected