adrienverge / yamllint

A linter for YAML files.
GNU General Public License v3.0
2.9k stars 278 forks source link

feature: add ability to have in one config file multiple configs for different paths #670

Open marcindabrowski opened 6 months ago

marcindabrowski commented 6 months ago

It would be great to give ability to define different configuration for different paths in one config file, ie:

---

extends: default

yaml-files:
  - '*.yaml'
  - '*.yml'
  - '.yamllint'

rules:
  # default rules for all files in directory

---

yaml-files:
  - 'folder1/*.yaml'

rules:
  # rules that overrides some config flags for all yamls in folder1

I'm aware that I can run yamllint with different configs for different sets of files, but this approach could simplify the usage.

Why I want this change? Because the problem with on key in GitHub Workflows. I would like to have ability to change one config rule for given path.

adrienverge commented 6 months ago

Hello, and thanks for the clear proposal :+1:

I'm not sure the need is worth creating a feature to parse different YAML documents from a single config file, and handle their potential conflicts.

Why I want this change? Because the problem with on key in GitHub Workflows. I would like to have ability to change one config rule for given path.

Have you considered one of these 4 solutions to allow on key in GitHub workflows?