yamllint icon indicating copy to clipboard operation
yamllint copied to clipboard

ability to distinguish between different yaml file types

Open ssbarnea opened this issue 3 years ago • 0 comments

In order to be able to perform a good linting of YAML files, yamllint needs to know the nature of the files.

For examples https://github.com/adrienverge/yamllint/pull/288 enables sorting of map keys, something really desirable for generic data storage but not desirable in all cases, counter examples below:

  • ansible tasks prefer having name as first key
  • zuul actions/workflows would want name as first key
  • zuul CI: would prefer name of jobs as first key too

Yes, almost all the time when someone uses a "name" key, they would want this to be the first key of the mapping. Still, harcoding a deliberate exception to the unbiased alphabetical sorting does not seem like a good idea either.

Mainly the decision about sorting logic should be dependent on the YAML file schema, something that was not yet accepted as part of the YAML spec. I guess we need to ping yaml spec writers to get their support and at least document the likely way this would be defined.

ssbarnea avatar Jul 27 '20 12:07 ssbarnea