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

Method IsInAlphabeticalOrder

support/cpplint.py:792–811  ·  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

790 return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
791
792 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
793 """Check if a header is in alphabetical order with the previous header.
794
795 Args:
796 clean_lines: A CleansedLines instance containing the file.
797 linenum: The number of the line to check.
798 header_path: Canonicalized header to be checked.
799
800 Returns:
801 Returns true if the header is in alphabetical order.
802 """
803 # If previous section is different from current section, _last_header will
804 # be reset to empty string, so it's always less than current header.
805 #
806 # If previous line was a blank line, assume that the headers are
807 # intentionally sorted the way they are.
808 if (self._last_header > header_path and
809 Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])):
810 return False
811 return True
812
813 def CheckNextIncludeOrder(self, header_type):
814 """Returns a non-empty error message if the next header is out of order.

Callers 1

CheckIncludeLineFunction · 0.80

Calls 1

MatchFunction · 0.85

Tested by

no test coverage detected