@@ 5897-5924 (lines=28) @@ | ||
5894 | isinstance(nesting_state.stack[-2], _NamespaceInfo)) |
|
5895 | ||
5896 | ||
5897 | def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item, |
|
5898 | raw_lines_no_comments, linenum): |
|
5899 | """This method determines if we should apply our namespace indentation check. |
|
5900 | ||
5901 | Args: |
|
5902 | nesting_state: The current nesting state. |
|
5903 | is_namespace_indent_item: If we just put a new class on the stack, True. |
|
5904 | If the top of the stack is not a class, or we did not recently |
|
5905 | add the class, False. |
|
5906 | raw_lines_no_comments: The lines without the comments. |
|
5907 | linenum: The current line number we are processing. |
|
5908 | ||
5909 | Returns: |
|
5910 | True if we should apply our namespace indentation check. Currently, it |
|
5911 | only works for classes and namespaces inside of a namespace. |
|
5912 | """ |
|
5913 | ||
5914 | is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments, |
|
5915 | linenum) |
|
5916 | ||
5917 | if not (is_namespace_indent_item or is_forward_declaration): |
|
5918 | return False |
|
5919 | ||
5920 | # If we are in a macro, we do not want to check the namespace indentation. |
|
5921 | if IsMacroDefinition(raw_lines_no_comments, linenum): |
|
5922 | return False |
|
5923 | ||
5924 | return IsBlockInNameSpace(nesting_state, is_forward_declaration) |
|
5925 | ||
5926 | ||
5927 | # Call this method if the line is directly inside of a namespace. |
@@ 5897-5924 (lines=28) @@ | ||
5894 | isinstance(nesting_state.stack[-2], _NamespaceInfo)) |
|
5895 | ||
5896 | ||
5897 | def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item, |
|
5898 | raw_lines_no_comments, linenum): |
|
5899 | """This method determines if we should apply our namespace indentation check. |
|
5900 | ||
5901 | Args: |
|
5902 | nesting_state: The current nesting state. |
|
5903 | is_namespace_indent_item: If we just put a new class on the stack, True. |
|
5904 | If the top of the stack is not a class, or we did not recently |
|
5905 | add the class, False. |
|
5906 | raw_lines_no_comments: The lines without the comments. |
|
5907 | linenum: The current line number we are processing. |
|
5908 | ||
5909 | Returns: |
|
5910 | True if we should apply our namespace indentation check. Currently, it |
|
5911 | only works for classes and namespaces inside of a namespace. |
|
5912 | """ |
|
5913 | ||
5914 | is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments, |
|
5915 | linenum) |
|
5916 | ||
5917 | if not (is_namespace_indent_item or is_forward_declaration): |
|
5918 | return False |
|
5919 | ||
5920 | # If we are in a macro, we do not want to check the namespace indentation. |
|
5921 | if IsMacroDefinition(raw_lines_no_comments, linenum): |
|
5922 | return False |
|
5923 | ||
5924 | return IsBlockInNameSpace(nesting_state, is_forward_declaration) |
|
5925 | ||
5926 | ||
5927 | # Call this method if the line is directly inside of a namespace. |