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

Method PerformSingleLineLint

cpplint_unittest.py:144–165  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

142
143 # Perform lint on single line of input and return the error message.
144 def PerformSingleLineLint(self, code):
145 error_collector = ErrorCollector(self.assertTrue)
146 lines = code.split("\n")
147 cpplint.RemoveMultiLineComments("foo.h", lines, error_collector)
148 clean_lines = cpplint.CleansedLines(lines)
149 include_state = cpplint._IncludeState()
150 function_state = cpplint._FunctionState()
151 nesting_state = cpplint.NestingState()
152 cpplint.ProcessLine(
153 "foo.cc",
154 "cc",
155 clean_lines,
156 0,
157 include_state,
158 function_state,
159 nesting_state,
160 error_collector,
161 )
162 # Single-line lint tests are allowed to fail the 'unlintable function'
163 # check.
164 error_collector.RemoveIfPresent("Lint failed to find start of function body.")
165 return error_collector.Results()
166
167 # Perform lint over multiple lines and return the error message.
168 def PerformMultiLineLint(self, code):

Callers 4

TestLintContainsMethod · 0.95
TestLintNotContainsMethod · 0.95
TestLintMethod · 0.95

Calls 3

RemoveIfPresentMethod · 0.95
ResultsMethod · 0.95
ErrorCollectorClass · 0.85

Tested by

no test coverage detected