MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / ShouldCheckNamespaceIndentation

Function ShouldCheckNamespaceIndentation

src/tests/coding/cpplint.py:6294–6321  ·  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

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