| 2298 | self.is_derived = True |
| 2299 | |
| 2300 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2301 | # If there is a DISALLOW macro, it should appear near the end of |
| 2302 | # the class. |
| 2303 | seen_last_thing_in_class = False |
| 2304 | for i in xrange(linenum - 1, self.starting_linenum, -1): |
| 2305 | match = Search( |
| 2306 | r'\b(DISALLOW_COPY_AND_ASSIGN|DISALLOW_IMPLICIT_CONSTRUCTORS)\(' + |
| 2307 | self.name + r'\)', |
| 2308 | clean_lines.elided[i]) |
| 2309 | if match: |
| 2310 | if seen_last_thing_in_class: |
| 2311 | error(filename, i, 'readability/constructors', 3, |
| 2312 | match.group(1) + ' should be the last thing in the class') |
| 2313 | break |
| 2314 | |
| 2315 | if not Match(r'^\s*$', clean_lines.elided[i]): |
| 2316 | seen_last_thing_in_class = True |
| 2317 | |
| 2318 | # Check that closing brace is aligned with beginning of the class. |
| 2319 | # Only do this if the closing brace is indented by only whitespaces. |
| 2320 | # This means we will not check single-line class definitions. |
| 2321 | indent = Match(r'^( *)\}', clean_lines.elided[linenum]) |
| 2322 | if indent and len(indent.group(1)) != self.class_indent: |
| 2323 | if self.is_struct: |
| 2324 | parent = 'struct ' + self.name |
| 2325 | else: |
| 2326 | parent = 'class ' + self.name |
| 2327 | error(filename, linenum, 'whitespace/indent', 3, |
| 2328 | 'Closing brace should be aligned with beginning of %s' % parent) |
| 2329 | |
| 2330 | |
| 2331 | class _NamespaceInfo(_BlockInfo): |