MCPcopy Create free account
hub / github.com/apache/mesos / ShouldCheckNamespaceIndentation

Function ShouldCheckNamespaceIndentation

support/cpplint.py:5739–5766  ·  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

5737
5738
5739def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
5740 raw_lines_no_comments, linenum):
5741 """This method determines if we should apply our namespace indentation check.
5742
5743 Args:
5744 nesting_state: The current nesting state.
5745 is_namespace_indent_item: If we just put a new class on the stack, True.
5746 If the top of the stack is not a class, or we did not recently
5747 add the class, False.
5748 raw_lines_no_comments: The lines without the comments.
5749 linenum: The current line number we are processing.
5750
5751 Returns:
5752 True if we should apply our namespace indentation check. Currently, it
5753 only works for classes and namespaces inside of a namespace.
5754 """
5755
5756 is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments,
5757 linenum)
5758
5759 if not (is_namespace_indent_item or is_forward_declaration):
5760 return False
5761
5762 # If we are in a macro, we do not want to check the namespace indentation.
5763 if IsMacroDefinition(raw_lines_no_comments, linenum):
5764 return False
5765
5766 return IsBlockInNameSpace(nesting_state, is_forward_declaration)
5767
5768
5769# 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