MCPcopy Create free account
hub / github.com/DSGWJQ/Feagent / validate_directory

Function validate_directory

scripts/validate_node_definitions.py:68–99  ·  view source on GitHub ↗

校验目录下所有 YAML 文件 参数: validator: 校验器实例 dir_path: 目录路径 strict: 是否严格模式 返回: (通过数, 失败数)

(
    validator: NodeYamlValidator, dir_path: Path, strict: bool = False
)

Source from the content-addressed store, hash-verified

66
67
68def validate_directory(
69 validator: NodeYamlValidator, dir_path: Path, strict: bool = False
70) -> tuple[int, int]:
71 """校验目录下所有 YAML 文件
72
73 参数:
74 validator: 校验器实例
75 dir_path: 目录路径
76 strict: 是否严格模式
77
78 返回:
79 (通过数, 失败数)
80 """
81 passed = 0
82 failed = 0
83
84 yaml_files = list(dir_path.glob("*.yaml")) + list(dir_path.glob("*.yml"))
85
86 if not yaml_files:
87 print(f"[WARN] No YAML files found in {dir_path}")
88 return 0, 0
89
90 print(f"\nValidating {len(yaml_files)} files in {dir_path}\n")
91 print("-" * 60)
92
93 for yaml_file in sorted(yaml_files):
94 if validate_file(validator, yaml_file, strict):
95 passed += 1
96 else:
97 failed += 1
98
99 return passed, failed
100
101
102def main():

Callers 1

mainFunction · 0.85

Calls 1

validate_fileFunction · 0.85

Tested by

no test coverage detected