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)
| 6305 | |
| 6306 | |
| 6307 | def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item, |
| 6308 | raw_lines_no_comments, linenum): |
| 6309 | """This method determines if we should apply our namespace indentation check. |
| 6310 | |
| 6311 | Args: |
| 6312 | nesting_state: The current nesting state. |
| 6313 | is_namespace_indent_item: If we just put a new class on the stack, True. |
| 6314 | If the top of the stack is not a class, or we did not recently |
| 6315 | add the class, False. |
| 6316 | raw_lines_no_comments: The lines without the comments. |
| 6317 | linenum: The current line number we are processing. |
| 6318 | |
| 6319 | Returns: |
| 6320 | True if we should apply our namespace indentation check. Currently, it |
| 6321 | only works for classes and namespaces inside of a namespace. |
| 6322 | """ |
| 6323 | |
| 6324 | is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments, |
| 6325 | linenum) |
| 6326 | |
| 6327 | if not (is_namespace_indent_item or is_forward_declaration): |
| 6328 | return False |
| 6329 | |
| 6330 | # If we are in a macro, we do not want to check the namespace indentation. |
| 6331 | if IsMacroDefinition(raw_lines_no_comments, linenum): |
| 6332 | return False |
| 6333 | |
| 6334 | return IsBlockInNameSpace(nesting_state, is_forward_declaration) |
| 6335 | |
| 6336 | |
| 6337 | # Call this method if the line is directly inside of a namespace. |
no test coverage detected