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

Method IsInAlphabeticalOrder

util/cpplint.py:776–795  ·  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

774 return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
775
776 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
777 """Check if a header is in alphabetical order with the previous header.
778
779 Args:
780 clean_lines: A CleansedLines instance containing the file.
781 linenum: The number of the line to check.
782 header_path: Canonicalized header to be checked.
783
784 Returns:
785 Returns true if the header is in alphabetical order.
786 """
787 # If previous section is different from current section, _last_header will
788 # be reset to empty string, so it's always less than current header.
789 #
790 # If previous line was a blank line, assume that the headers are
791 # intentionally sorted the way they are.
792 if (self._last_header > header_path and
793 Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])):
794 return False
795 return True
796
797 def CheckNextIncludeOrder(self, header_type):
798 """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