| 2789 | self.is_derived = True |
| 2790 | |
| 2791 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2792 | # If there is a DISALLOW macro, it should appear near the end of |
| 2793 | # the class. |
| 2794 | seen_last_thing_in_class = False |
| 2795 | for i in xrange(linenum - 1, self.starting_linenum, -1): |
| 2796 | match = Search( |
| 2797 | r'\b(DISALLOW_COPY_AND_ASSIGN|DISALLOW_IMPLICIT_CONSTRUCTORS)\(' + |
| 2798 | self.name + r'\)', |
| 2799 | clean_lines.elided[i]) |
| 2800 | if match: |
| 2801 | if seen_last_thing_in_class: |
| 2802 | error(filename, i, 'readability/constructors', 3, |
| 2803 | match.group(1) + ' should be the last thing in the class') |
| 2804 | break |
| 2805 | |
| 2806 | if not Match(r'^\s*$', clean_lines.elided[i]): |
| 2807 | seen_last_thing_in_class = True |
| 2808 | |
| 2809 | # Check that closing brace is aligned with beginning of the class. |
| 2810 | # Only do this if the closing brace is indented by only whitespaces. |
| 2811 | # This means we will not check single-line class definitions. |
| 2812 | indent = Match(r'^( *)\}', clean_lines.elided[linenum]) |
| 2813 | if indent and len(indent.group(1)) != self.class_indent: |
| 2814 | if self.is_struct: |
| 2815 | parent = 'struct ' + self.name |
| 2816 | else: |
| 2817 | parent = 'class ' + self.name |
| 2818 | error(filename, linenum, 'whitespace/indent', 3, |
| 2819 | 'Closing brace should be aligned with beginning of %s' % parent) |
| 2820 | |
| 2821 | |
| 2822 | class _NamespaceInfo(_BlockInfo): |