-
Notifications
You must be signed in to change notification settings - Fork 270
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
Rule feature request: brackets - forbid after maximum size #680
Comments
Hello Adam, thanks for the proposal. But 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 max number of items (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 content-oriented rules. |
In this, i'm referring solely to the form of the YAML.. Currently "forbid" will disallow simple one-liners like
|
Thanks for the clarification! Sorry, I initially misunderstood your proposal. → You want to be able to force sequences to be in block-style (i.e. forbid flow-style) if they contain more than n elements. And the same for mappings, I suppose. Indeed this is about the form of the YAML, so it could be accepted. But it seems a bit a "niche" use case, and the goal (have "cleaner" and "easier to read" data) can maybe be achieved using the |
Rule feature to expand existing
brackets
to allow flow-style brackets for arrays up to n items, but forbid for longer than that.e.g. { forbid: { max_size: 3 } }
PASS
[ 1, 2, 3 ]
FAIL
[ 1, 2, 3, 4, 5 ]
May also want to extend to allowing only certain character lengths in flow-style, or forbidding nested objects while allowing primitives.
The text was updated successfully, but these errors were encountered: