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

Function check_file

ci/lint_python/sys_path_checker.py:57–74  ·  view source on GitHub ↗

Parse source and return SPI001 violations not suppressed by noqa.

(path: str, source: str)

Source from the content-addressed store, hash-verified

55
56
57def check_file(path: str, source: str) -> list[tuple[int, str]]:
58 """Parse source and return SPI001 violations not suppressed by noqa."""
59 try:
60 tree = ast.parse(source, filename=path)
61 except SyntaxError:
62 return []
63
64 visitor = SysPathVisitor()
65 visitor.visit(tree)
66
67 # Silently filter out violations on lines with noqa SPI001 suppression
68 lines = source.splitlines()
69 result: list[tuple[int, str]] = []
70 for line_no, message in visitor.violations:
71 if line_no <= len(lines) and _NOQA_RE.search(lines[line_no - 1]):
72 continue
73 result.append((line_no, message))
74 return result
75
76
77def collect_python_files(

Callers 1

mainFunction · 0.70

Calls 4

SysPathVisitorClass · 0.85
parseMethod · 0.45
visitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected