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)
| 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. |
no test coverage detected