MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / lint_file

Function lint_file

skills/remotion-to-hyperframes/scripts/lint_source.py:274–299  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

272
273
274def lint_file(path: Path) -> list[Finding]:
275 src = path.read_text()
276 findings: list[Finding] = []
277
278 def loc(offset: int) -> tuple[int, int]:
279 line = src.count("\n", 0, offset) + 1
280 col = offset - (src.rfind("\n", 0, offset) + 1) + 1
281 return line, col
282
283 for rule in RULES:
284 for offset, override_message in rule.matcher(src):
285 line, col = loc(offset)
286 findings.append(
287 Finding(
288 str(path),
289 line,
290 col,
291 rule.severity,
292 rule.rule_id,
293 override_message or rule.message,
294 rule.recommendation,
295 )
296 )
297
298 findings.sort(key=lambda f: (f.file, f.line, f.column))
299 return findings
300
301
302def main() -> int:

Callers 1

mainFunction · 0.85

Calls 2

locFunction · 0.85
FindingClass · 0.85

Tested by

no test coverage detected