MCPcopy Create free account
hub / github.com/DevCloudNinjas/DevOps-Projects / check_python_syntax

Method check_python_syntax

tools/quality_gate.py:329–348  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

327 return findings
328
329 def check_python_syntax(self) -> list[Finding]:
330 findings: list[Finding] = []
331 for path in self.git_files("*.py"):
332 full_path = self.repo_root / path
333 if not full_path.is_file() or "__pycache__" in path.parts:
334 continue
335 try:
336 ast.parse(full_path.read_text(encoding="utf-8"), filename=str(path))
337 except SyntaxError as exc:
338 findings.append(
339 Finding(
340 "python-syntax",
341 path,
342 exc.msg,
343 line=exc.lineno,
344 ),
345 )
346 except UnicodeDecodeError as exc:
347 findings.append(Finding("python-syntax", path, f"could not decode as UTF-8: {exc}"))
348 return findings
349
350 def check_node_package_locks(self) -> list[Finding]:
351 findings: list[Finding] = []

Callers 2

check_syntaxMethod · 0.95

Calls 2

git_filesMethod · 0.95
FindingClass · 0.70