MCPcopy Create free account
hub / github.com/alibaba/GraphScope / CheckNextIncludeOrder

Method CheckNextIncludeOrder

analytical_engine/misc/cpplint.py:1189–1246  ·  view source on GitHub ↗

Returns a non-empty error message if the next header is out of order. This function also updates the internal state to be ready to check the next include. Args: header_type: One of the _XXX_HEADER constants defined above. Returns: The empty string if the header is in t

(self, header_type)

Source from the content-addressed store, hash-verified

1187 return True
1188
1189 def CheckNextIncludeOrder(self, header_type):
1190 """Returns a non-empty error message if the next header is out of order.
1191
1192 This function also updates the internal state to be ready to check
1193 the next include.
1194
1195 Args:
1196 header_type: One of the _XXX_HEADER constants defined above.
1197
1198 Returns:
1199 The empty string if the header is in the right order, or an
1200 error message describing what's wrong.
1201
1202 """
1203 error_message = ('Found %s after %s' %
1204 (self._TYPE_NAMES[header_type],
1205 self._SECTION_NAMES[self._section]))
1206
1207 last_section = self._section
1208
1209 if header_type == _C_SYS_HEADER:
1210 if self._section <= self._C_SECTION:
1211 self._section = self._C_SECTION
1212 else:
1213 self._last_header = ''
1214 return error_message
1215 elif header_type == _CPP_SYS_HEADER:
1216 if self._section <= self._CPP_SECTION:
1217 self._section = self._CPP_SECTION
1218 else:
1219 self._last_header = ''
1220 return error_message
1221 elif header_type == _OTHER_SYS_HEADER:
1222 if self._section <= self._OTHER_SYS_SECTION:
1223 self._section = self._OTHER_SYS_SECTION
1224 else:
1225 self._last_header = ''
1226 return error_message
1227 elif header_type == _LIKELY_MY_HEADER:
1228 if self._section <= self._MY_H_SECTION:
1229 self._section = self._MY_H_SECTION
1230 else:
1231 self._section = self._OTHER_H_SECTION
1232 elif header_type == _POSSIBLE_MY_HEADER:
1233 if self._section <= self._MY_H_SECTION:
1234 self._section = self._MY_H_SECTION
1235 else:
1236 # This will always be the fallback because we're not sure
1237 # enough that the header is associated with this file.
1238 self._section = self._OTHER_H_SECTION
1239 else:
1240 assert header_type == _OTHER_HEADER
1241 self._section = self._OTHER_H_SECTION
1242
1243 if last_section != self._section:
1244 self._last_header = ''
1245
1246 return ''

Callers 1

CheckIncludeLineFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected