MCPcopy Create free account
hub / github.com/apache/mesos / CheckEnd

Method CheckEnd

support/cpplint.py:2305–2333  ·  view source on GitHub ↗
(self, filename, clean_lines, linenum, error)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

SearchFunction · 0.85
errorFunction · 0.85
MatchFunction · 0.85

Tested by

no test coverage detected