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)
| 1177 | return header_path.replace('-inl.h', '.h').replace('-', '_').lower() |
| 1178 | |
| 1179 | def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path): |
| 1180 | """Check if a header is in alphabetical order with the previous header. |
| 1181 | |
| 1182 | Args: |
| 1183 | clean_lines: A CleansedLines instance containing the file. |
| 1184 | linenum: The number of the line to check. |
| 1185 | header_path: Canonicalized header to be checked. |
| 1186 | |
| 1187 | Returns: |
| 1188 | Returns true if the header is in alphabetical order. |
| 1189 | """ |
| 1190 | # If previous section is different from current section, _last_header will |
| 1191 | # be reset to empty string, so it's always less than current header. |
| 1192 | # |
| 1193 | # If previous line was a blank line, assume that the headers are |
| 1194 | # intentionally sorted the way they are. |
| 1195 | if (self._last_header > header_path and |
| 1196 | Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])): |
| 1197 | return False |
| 1198 | return True |
| 1199 | |
| 1200 | def CheckNextIncludeOrder(self, header_type): |
| 1201 | """Returns a non-empty error message if the next header is out of order. |
no test coverage detected