MCPcopy Index your code
hub / github.com/cpplint/cpplint / PerformIncludeWhatYouUse

Method PerformIncludeWhatYouUse

cpplint_unittest.py:221–239  ·  view source on GitHub ↗
(self, code, filename="foo.h", io=codecs)

Source from the content-addressed store, hash-verified

219 return error_collector.Results()
220
221 def PerformIncludeWhatYouUse(self, code, filename="foo.h", io=codecs):
222 # First, build up the include state.
223 error_collector = ErrorCollector(self.assertTrue)
224 include_state = cpplint._IncludeState()
225 nesting_state = cpplint.NestingState()
226 lines = code.split("\n")
227 cpplint.RemoveMultiLineComments(filename, lines, error_collector)
228 lines = cpplint.CleansedLines(lines)
229 for i in range(lines.NumLines()):
230 cpplint.CheckLanguage(
231 filename, lines, i, ".h", include_state, nesting_state, error_collector
232 )
233 # We could clear the error_collector here, but this should
234 # also be fine, since our IncludeWhatYouUse unittests do not
235 # have language problems.
236
237 # Second, look for missing includes.
238 cpplint.CheckForIncludeWhatYouUse(filename, lines, include_state, error_collector, io)
239 return error_collector.Results()
240
241 # Perform lint and make sure one of the errors is what we want
242 def TestLintContains(self, code, expected_message):

Calls 3

NumLinesMethod · 0.95
ResultsMethod · 0.95
ErrorCollectorClass · 0.85

Tested by

no test coverage detected