MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / CheckEnd

Method CheckEnd

util/cpplint.py:2205–2233  ·  view source on GitHub ↗
(self, filename, clean_lines, linenum, error)

Source from the content-addressed store, hash-verified

2203 self.is_derived = True
2204
2205 def CheckEnd(self, filename, clean_lines, linenum, error):
2206 # If there is a DISALLOW macro, it should appear near the end of
2207 # the class.
2208 seen_last_thing_in_class = False
2209 for i in range(linenum - 1, self.starting_linenum, -1):
2210 match = Search(
2211 r'\b(DISALLOW_COPY_AND_ASSIGN|DISALLOW_IMPLICIT_CONSTRUCTORS)\(' +
2212 self.name + r'\)',
2213 clean_lines.elided[i])
2214 if match:
2215 if seen_last_thing_in_class:
2216 error(filename, i, 'readability/constructors', 3,
2217 match.group(1) + ' should be the last thing in the class')
2218 break
2219
2220 if not Match(r'^\s*$', clean_lines.elided[i]):
2221 seen_last_thing_in_class = True
2222
2223 # Check that closing brace is aligned with beginning of the class.
2224 # Only do this if the closing brace is indented by only whitespaces.
2225 # This means we will not check single-line class definitions.
2226 indent = Match(r'^( *)\}', clean_lines.elided[linenum])
2227 if indent and len(indent.group(1)) != self.class_indent:
2228 if self.is_struct:
2229 parent = 'struct ' + self.name
2230 else:
2231 parent = 'class ' + self.name
2232 error(filename, linenum, 'whitespace/indent', 3,
2233 'Closing brace should be aligned with beginning of %s' % parent)
2234
2235
2236class _NamespaceInfo(_BlockInfo):

Callers

nothing calls this directly

Calls 3

SearchFunction · 0.85
errorFunction · 0.85
MatchFunction · 0.85

Tested by

no test coverage detected