Files
DmitryandClaude Opus 5 a7b0635830 Add lint configuration and Gitea Actions CI
Configure yamllint and ansible-lint, plus a workflow running yamllint,
ansible-lint and ansible-playbook --syntax-check over every playbook.

ansible-lint uses the moderate profile: on the current code it reports
exactly the same violations as basic, so it costs nothing today while
holding a higher bar for new code. skip_list is empty; noisy legacy
rules go to warn_list with a comment on why and when to restore them.
Correctness and safety rules stay fatal.

Two constraints are encoded in the workflow: syntax-check must run from
ansible/ because roles_path is relative, and ansible-lint needs absolute
ANSIBLE_ROLES_PATH/ANSIBLE_COLLECTIONS_PATH when run from the root.

The runner is not registered yet; registration notes are in the workflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTocXkGUUazHdKKd3r9k71
2026-08-26 22:09:59 +03:00

70 lines
2.6 KiB
Plaintext

---
# yamllint для HomeLab infras.
# Цель: ловить реальные поломки YAML (табы, дубли ключей, битые отступы,
# незакрытые кавычки), а не навязывать стиль. Всё, что даёт шум на живом
# Ansible-коде, ослаблено осознанно — см. комментарии.
extends: default
# gitignore-style пути, которые линтить не нужно.
ignore: |
/ansible/.venv/
/ansible/collections/
/ansible/generated/
/archive/
/.opencode/
/tools/
node_modules/
/ansible/inventory/host_vars/*/vault.yml
/.direnv/
/result
/result-*
rules:
# Длинные строки — норма: pct/docker/curl-команды в one-line shell,
# длинные URL, ZeroTier/OpenVPN-конфиги. Перенос сделал бы их менее читаемыми.
line-length: disable
# Ansible исторически допускает yes/no наравне с true/false, и часть репо
# написана так. Не ошибка — не мешаем.
truthy:
allowed-values: ['true', 'false', 'yes', 'no']
check-keys: false
# Комментарии вида "#comment" и inline-комментарии на одном пробеле
# встречаются часто и ни на что не влияют.
comments:
require-starting-space: true
min-spaces-from-content: 1
comments-indentation: disable
# Ansible-стиль: списки под ключом с отступом — вопрос вкуса, обе формы валидны.
indentation:
spaces: 2
indent-sequences: consistent
check-multi-line-strings: false
# Пустая строка в конце файла обязательна (реальные diff-артефакты),
# но лишние пробелы в конце строк — только предупреждение.
trailing-spaces: enable
new-line-at-end-of-file: enable
# Ошибки, которые ломают парсинг или молча меняют смысл — строго.
key-duplicates: enable
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
# "---" в начале файла — полезная конвенция Ansible, но не критично.
document-start:
level: warning
# braces/brackets: Jinja-выражения в inline-словарях часто дают ложные
# срабатывания на пробелах внутри {{ }}.
braces:
min-spaces-inside: 0
max-spaces-inside: 1
brackets:
min-spaces-inside: 0
max-spaces-inside: 1