mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-11 17:49:25 -05:00
refactor(validation): simplify to direct yamllint approach
- Remove custom Python script (validate_yaml.py) - Use direct yamllint in pre-commit for simplicity - Update .yamllint config to disable style checks - Focus only on critical syntax errors - Better performance and standard approach - Maintain same validation coverage for all YAML files
This commit is contained in:
@@ -173,13 +173,21 @@ repos:
|
||||
language: system
|
||||
pass_filenames: false
|
||||
|
||||
# --- YAML Validation (All YAML Files) ---
|
||||
- id: validate-yaml-files
|
||||
name: "Validate all YAML files"
|
||||
entry: python tools/scripts/validate_yaml.py
|
||||
language: python
|
||||
additional_dependencies:
|
||||
- yamllint
|
||||
pass_filenames: false
|
||||
files: ''
|
||||
description: "Validate all YAML files in the project"
|
||||
# --- YAML Validation ---
|
||||
- id: yamllint
|
||||
name: "Validate YAML files"
|
||||
entry: yamllint
|
||||
language: system
|
||||
args: [--config-file=.yamllint]
|
||||
files: \.(yml|yaml)$
|
||||
exclude: |
|
||||
(?x)^(
|
||||
node_modules/|
|
||||
\.git/|
|
||||
_site/|
|
||||
_book/|
|
||||
\.venv/|
|
||||
__pycache__/|
|
||||
\.pyc$
|
||||
)$
|
||||
description: "Validate all YAML files with custom config"
|
||||
|
||||
@@ -9,5 +9,10 @@ rules:
|
||||
indentation: disable
|
||||
new-line-at-end-of-file: disable
|
||||
truthy: disable
|
||||
empty-lines: disable
|
||||
colons: disable
|
||||
commas: disable
|
||||
brackets: disable
|
||||
comments: disable
|
||||
|
||||
# Only check for critical syntax errors
|
||||
13
tools/scripts/validate_yaml.py → tools/scripts/validate_workflows.py
Executable file → Normal file
13
tools/scripts/validate_yaml.py → tools/scripts/validate_workflows.py
Executable file → Normal file
@@ -92,19 +92,12 @@ def validate_all_yaml_files():
|
||||
yaml_files.extend(Path(search_dir).glob('**/*.yml'))
|
||||
yaml_files.extend(Path(search_dir).glob('**/*.yaml'))
|
||||
|
||||
# Filter out excluded files and remove duplicates
|
||||
# Filter out excluded files
|
||||
filtered_files = []
|
||||
seen_files = set()
|
||||
for yaml_file in yaml_files:
|
||||
file_path = str(yaml_file)
|
||||
# Skip if already seen
|
||||
if file_path in seen_files:
|
||||
continue
|
||||
# Skip if matches exclude patterns
|
||||
if any(pattern.replace('**', '').replace('*', '') in file_path for pattern in exclude_patterns):
|
||||
continue
|
||||
filtered_files.append(yaml_file)
|
||||
seen_files.add(file_path)
|
||||
if not any(pattern.replace('**', '').replace('*', '') in file_path for pattern in exclude_patterns):
|
||||
filtered_files.append(yaml_file)
|
||||
|
||||
if not filtered_files:
|
||||
print("⚠️ No YAML files found")
|
||||
Reference in New Issue
Block a user