MCPcopy Index your code
hub / github.com/nodejs/node / IsInAlphabeticalOrder

Method IsInAlphabeticalOrder

tools/cpplint.py:1348–1367  ·  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

(self, clean_lines, linenum, header_path)

Source from the content-addressed store, hash-verified

1346 return header_path.replace("-inl.h", ".h").replace("-", "_").lower()
1347
1348 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
1349 """Check if a header is in alphabetical order with the previous header.
1350
1351 Args:
1352 clean_lines: A CleansedLines instance containing the file.
1353 linenum: The number of the line to check.
1354 header_path: Canonicalized header to be checked.
1355
1356 Returns:
1357 Returns true if the header is in alphabetical order.
1358 """
1359 # If previous section is different from current section, _last_header will
1360 # be reset to empty string, so it's always less than current header.
1361 #
1362 # If previous line was a blank line, assume that the headers are
1363 # intentionally sorted the way they are.
1364 return not (
1365 self._last_header > header_path
1366 and re.match(r"^\s*#\s*include\b", clean_lines.elided[linenum - 1])
1367 )
1368
1369 def CheckNextIncludeOrder(self, header_type):
1370 """Returns a non-empty error message if the next header is out of order.

Callers 1

CheckIncludeLineFunction · 0.80

Calls 1

matchMethod · 0.65

Tested by

no test coverage detected