Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for rule on max number of values #616

Open
jonzerstyle opened this issue Nov 22, 2023 · 1 comment
Open

Request for rule on max number of values #616

jonzerstyle opened this issue Nov 22, 2023 · 1 comment

Comments

@jonzerstyle
Copy link

This is such a great project. Thank you so much.

This is not an issue. It is a request for a feature that would be nice to have.

In my yaml files there should only be one value per key.

Like so,

KeyA: ValA

Never.

KeyA: ValA ValB

It would be great if there was a rule to set the maximum number of values. Similar to being able to specify the maximum line length. I looked through all the issues and existing rules and could not find such a rule. I apologize if there is one and I missed it.

@adrienverge
Copy link
Owner

Hello and thanks for this request for a feature.

The goal of yamllint is to lint the form of YAML, not the content or its structure. We could imagine many new rules to check the number of words in a string value (what you propose), or the type of values, or that all strings contain a substring, or that all keys match a regex, etc. But the purpose of yamllint is to be focused on YAML itself, so I'm not favorable to adding such new content-oriented rules.

To achieve what you want, I would suggest writing a simple script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants