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)
| 1306 | return header_path.replace("-inl.h", ".h").replace("-", "_").lower() |
| 1307 | |
| 1308 | def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path): |
| 1309 | """Check if a header is in alphabetical order with the previous header. |
| 1310 | |
| 1311 | Args: |
| 1312 | clean_lines: A CleansedLines instance containing the file. |
| 1313 | linenum: The number of the line to check. |
| 1314 | header_path: Canonicalized header to be checked. |
| 1315 | |
| 1316 | Returns: |
| 1317 | Returns true if the header is in alphabetical order. |
| 1318 | """ |
| 1319 | # If previous section is different from current section, _last_header will |
| 1320 | # be reset to empty string, so it's always less than current header. |
| 1321 | # |
| 1322 | # If previous line was a blank line, assume that the headers are |
| 1323 | # intentionally sorted the way they are. |
| 1324 | return not ( |
| 1325 | self._last_header > header_path |
| 1326 | and re.match(r"^\s*#\s*include\b", clean_lines.elided[linenum - 1]) |
| 1327 | ) |
| 1328 | |
| 1329 | def CheckNextIncludeOrder(self, header_type): |
| 1330 | """Returns a non-empty error message if the next header is out of order. |