πŸ“‹YAML Linting

This repository includes comprehensive YAML linting and auto-fixing capabilities using yamllint and task automation.

Quick Start

Install Task (if not already installed)

# On macOS
brew install go-task/tap/go-task

# On Linux
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin

# Or download from https://github.com/go-task/task/releases

Setup Development Environment

# Install dependencies (including yamllint)
task setup

YAML Linting Commands

Using the Scripts Directly

Using VS Code Tasks

  • Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)

  • Type "Tasks: Run Task"

  • Choose from:

    • Lint YAML Files

    • Fix YAML Issues

    • Check YAML (Strict)

Configuration

yamllint Configuration (.yamllint.yml)

The repository includes a customized yamllint configuration that:

  • Sets line length to 120 characters (flexible for GitHub Actions)

  • Uses 2-space indentation

  • Allows common GitHub Actions truthy values (yes, no, on, off)

  • Ignores lock files and template directories

  • Provides warnings instead of errors for line length

Supported Files

The linting automatically finds and checks:

  • *.yml files

  • *.yaml files

  • Excludes: pnpm-lock.yaml, yarn.lock, package-lock.json

  • Ignores: node_modules, .git, venv, __pycache__

Integration

GitHub Actions

YAML linting is integrated into:

  1. Autofix Workflow (.github/workflows/autofix.yml) - Runs on every PR/push

  2. Dedicated YAML Lint Workflow (.github/workflows/yaml-lint.yml) - Triggered by YAML changes

Pre-commit Integration

Add to your development workflow:

Common YAML Issues and Fixes

1. Line Length

2. Indentation

3. Truthy Values

Troubleshooting

yamllint Not Found

Permission Denied

Custom Rules

Edit .yamllint.yml to customize rules for your needs. See yamllint documentation for all available options.

Available Task Commands

Run task --list to see all available commands:

Last updated

Was this helpful?