MCPcopy Create free account
hub / github.com/apache/mesos / CheckNextIncludeOrder

Method CheckNextIncludeOrder

support/cpplint.py:813–864  ·  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

811 return True
812
813 def CheckNextIncludeOrder(self, header_type):
814 """Returns a non-empty error message if the next header is out of order.
815
816 This function also updates the internal state to be ready to check
817 the next include.
818
819 Args:
820 header_type: One of the _XXX_HEADER constants defined above.
821
822 Returns:
823 The empty string if the header is in the right order, or an
824 error message describing what's wrong.
825
826 """
827 error_message = ('Found %s after %s' %
828 (self._TYPE_NAMES[header_type],
829 self._SECTION_NAMES[self._section]))
830
831 last_section = self._section
832
833 if header_type == _C_SYS_HEADER:
834 if self._section <= self._C_SECTION:
835 self._section = self._C_SECTION
836 else:
837 self._last_header = ''
838 return error_message
839 elif header_type == _CPP_SYS_HEADER:
840 if self._section <= self._CPP_SECTION:
841 self._section = self._CPP_SECTION
842 else:
843 self._last_header = ''
844 return error_message
845 elif header_type == _LIKELY_MY_HEADER:
846 if self._section <= self._MY_H_SECTION:
847 self._section = self._MY_H_SECTION
848 else:
849 self._section = self._OTHER_H_SECTION
850 elif header_type == _POSSIBLE_MY_HEADER:
851 if self._section <= self._MY_H_SECTION:
852 self._section = self._MY_H_SECTION
853 else:
854 # This will always be the fallback because we're not sure
855 # enough that the header is associated with this file.
856 self._section = self._OTHER_H_SECTION
857 else:
858 assert header_type == _OTHER_HEADER
859 self._section = self._OTHER_H_SECTION
860
861 if last_section != self._section:
862 self._last_header = ''
863
864 return ''
865
866
867class _CppLintState(object):

Callers 1

CheckIncludeLineFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected