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

Method IsInAlphabeticalOrder

analytical_engine/misc/cpplint.py:1168–1187  ·  view source on GitHub ↗

Check if a header is in alphabetical order with the previous header. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. header_path: Canonicalized header to be checked. Returns: Returns true if the header is in

(self, clean_lines, linenum, header_path)

Source from the content-addressed store, hash-verified

1166 return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
1167
1168 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
1169 """Check if a header is in alphabetical order with the previous header.
1170
1171 Args:
1172 clean_lines: A CleansedLines instance containing the file.
1173 linenum: The number of the line to check.
1174 header_path: Canonicalized header to be checked.
1175
1176 Returns:
1177 Returns true if the header is in alphabetical order.
1178 """
1179 # If previous section is different from current section, _last_header will
1180 # be reset to empty string, so it's always less than current header.
1181 #
1182 # If previous line was a blank line, assume that the headers are
1183 # intentionally sorted the way they are.
1184 if (self._last_header > header_path and
1185 Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])):
1186 return False
1187 return True
1188
1189 def CheckNextIncludeOrder(self, header_type):
1190 """Returns a non-empty error message if the next header is out of order.

Callers 1

CheckIncludeLineFunction · 0.80

Calls 1

MatchFunction · 0.70

Tested by

no test coverage detected