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

Method IsInAlphabeticalOrder

src/tests/coding/cpplint.py:1164–1183  ·  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

1162 return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
1163
1164 def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
1165 """Check if a header is in alphabetical order with the previous header.
1166
1167 Args:
1168 clean_lines: A CleansedLines instance containing the file.
1169 linenum: The number of the line to check.
1170 header_path: Canonicalized header to be checked.
1171
1172 Returns:
1173 Returns true if the header is in alphabetical order.
1174 """
1175 # If previous section is different from current section, _last_header will
1176 # be reset to empty string, so it's always less than current header.
1177 #
1178 # If previous line was a blank line, assume that the headers are
1179 # intentionally sorted the way they are.
1180 if (self._last_header > header_path and
1181 Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])):
1182 return False
1183 return True
1184
1185 def CheckNextIncludeOrder(self, header_type):
1186 """Returns a non-empty error message if the next header is out of order.

Callers 1

CheckIncludeLineFunction · 0.80

Calls 1

MatchFunction · 0.70

Tested by

no test coverage detected