MCPcopy Create free account
hub / github.com/alibaba/GraphScope / CheckEnd

Method CheckEnd

analytical_engine/misc/cpplint.py:2794–2822  ·  view source on GitHub ↗
(self, filename, clean_lines, linenum, error)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

SearchFunction · 0.85
MatchFunction · 0.70
groupMethod · 0.45

Tested by

no test coverage detected