Skip to content

pooyanazad/YAML-validator

Repository files navigation

YAML Validator

Validate YAML files for syntax errors, style issues, and security misconfigurations — all in one command.

YAML Validator output

Getting Started

Prerequisites: Docker installed on your system.

One-time setup (Linux/macOS)

Run this once to create the ytest shortcut:

# Bash
echo 'alias ytest="docker run --rm -v \"\$(pwd):/data\" pooyanazad/yaml-checker"' >> ~/.bashrc && source ~/.bashrc
Using Zsh instead?
echo 'alias ytest="docker run --rm -v \"\$(pwd):/data\" pooyanazad/yaml-checker"' >> ~/.zshrc && source ~/.zshrc

Now you can use ytest anywhere.

Usage

Note

The multiple files and directory scanning features will be available in v3, starting on June 1st.

# Single file
ytest myfile.yaml

# Multiple files
ytest config.yaml deployment.yaml secrets.yaml

# Entire directory (recursive)
ytest ./configs/

# Glob pattern
ytest ./configs/**/*.yaml
Windows / without the alias

PowerShell / CMD:

docker run --rm -v "%cd%:/data" pooyanazad/yaml-checker myfile.yaml

Git Bash:

MSYS_NO_PATHCONV=1 docker run --rm -v "$(pwd):/data" pooyanazad/yaml-checker myfile.yaml

Linux/macOS (no alias):

docker run --rm -v "$(pwd):/data" pooyanazad/yaml-checker myfile.yaml

What It Checks

Layer Tool What it catches
Syntax PyYAML Parse errors, broken structure, invalid indentation
Linting yamllint Style issues, line length, trailing spaces, consistency
Security Checkov Hardcoded secrets, privileged containers, misconfigurations

Issues are grouped by severity (Critical → High → Medium → Low) with colored output and a summary table. When scanning multiple files, you get a combined report showing which files have problems.

Features

✅ Multi-file & directory scanning
✅ Glob pattern support (**/*.yaml)
✅ Cross-platform (Windows, Linux, macOS)
✅ Multi-arch Docker image (amd64/arm64)
✅ Colored severity-based reporting
✅ Zero configuration required

Docker Image

Image pooyanazad/yaml-checker
Tag latest is always up to date
Base python:3.12-slim
Platforms linux/amd64, linux/arm64

Release Notes

v3.1.0-20260701 — 2026-07-01

Changes since last release:

  • test: mock timeout handling correctly (Day 10) (6753344)
  • feat: make timeout configurable (Day 9) (55bef66)
  • feat: add timeout to check_dependencies() (Day 8) (913339e)
  • feat: add timeouts to subprocess calls (Day 7) (7097990)
  • fix: add missing stderr to test mock (0a692be)
  • feat: handle yamllint edge cases gracefully (Day 6) (50d7aa1)
  • test: add Day 5 verification for regex parsing colons (30ff916)
  • fix: replace fragile string splitting with robust regex for yamllint parsing (fd1e0cf)
  • test: add Day 2 tests for ToolAvailability and check_dependencies() (6a42995)
  • refactor: replace CHECKOV_AVAILABLE global with ToolAvailability dataclass (3f6f670)
  • ci: add App Tests stage with pytest report output before Docker tests and release (4a741da)
  • test: add pytest app functionality tests (41 tests across 5 test classes) (b9e5032)
  • test: improve Docker integration tests with real exit code and output assertions (2fcec57)
  • ci: split pipeline into 7 separate jobs for clear stage visibility (0b38079)

Docker Image: pooyanazad/yaml-checker:v3.1.0-20260701

About

Easy and fast yaml validator, with just one line commands you will have everything you need on your cli

Resources

License

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors