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

Method check_yaml_syntax

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

Source from the content-addressed store, hash-verified

289 return findings
290
291 def check_yaml_syntax(self) -> list[Finding]:
292 if yaml is None:
293 return [
294 Finding(
295 "yaml-syntax",
296 Path("tools/requirements.txt"),
297 "PyYAML is required for YAML validation; run pip install -r tools/requirements.txt",
298 ),
299 ]
300 findings: list[Finding] = []
301 for path in self.git_files("*.yaml", "*.yml"):
302 full_path = self.repo_root / path
303 if not full_path.is_file() or is_templated_yaml(path):
304 continue
305 try:
306 text = full_path.read_text(encoding="utf-8")
307 list(yaml.load_all(text, Loader=IgnoreUnknownTagsLoader))
308 except Exception as exc:
309 findings.append(Finding("yaml-syntax", path, str(exc).splitlines()[0]))
310 return findings
311
312 def check_shell_syntax(self) -> list[Finding]:
313 findings: list[Finding] = []

Callers 1

check_syntaxMethod · 0.95

Calls 3

git_filesMethod · 0.95
is_templated_yamlFunction · 0.85
FindingClass · 0.70

Tested by

no test coverage detected