MCPcopy Create free account
hub / github.com/FastLED/FastLED / check_file_content

Method check_file_content

ci/lint_cpp/bare_libm_checker.py:187–217  ·  view source on GitHub ↗
(self, file_content: FileContent)

Source from the content-addressed store, hash-verified

185 return True
186
187 def check_file_content(self, file_content: FileContent) -> list[str]:
188 violations: list[tuple[int, str]] = []
189 in_block_comment = False
190
191 for line_number, line in enumerate(file_content.lines, 1):
192 stripped = line.strip()
193
194 # Track /* ... */ blocks. Single-line `/* ... */` is handled
195 # by the trailing-comment strip below.
196 if in_block_comment:
197 if "*/" in line:
198 in_block_comment = False
199 continue
200 if "/*" in line and "*/" not in line:
201 in_block_comment = True
202 continue
203
204 if stripped.startswith("//"):
205 continue
206 if _SUPPRESS in line:
207 continue
208
209 # Strip trailing // comment so the regex doesn't match inside it.
210 code = line.split("//")[0]
211 if _BANNED_PATTERN.search(code):
212 violations.append((line_number, line.rstrip()))
213
214 if violations:
215 self.violations[file_content.path] = violations
216
217 return []
218
219
220def main() -> None:

Callers 2

_violationsFunction · 0.45
_python_recordsFunction · 0.45

Calls 1

appendMethod · 0.45

Tested by 2

_violationsFunction · 0.36
_python_recordsFunction · 0.36