For large collections of YAML files, it would be helpful to offer an automated CLI flag to go ahead and format the files per yamllint configuration. Maybe a --apply
option?
There's a fair few issues that yamllint reports on that can be trivially autofixed. Examples include missing the document start indicator, and quoting strings. It would be great if yamllint had this functionality, as it would greatly speed up the adoption time for older codebases.
Hello, +1 with @andrewimeson.
Closing this as a duplicate of #62, #209, #230, #231 and #269.
docs: Fix misleading Python API example
yamllint.linter.run("example.yaml", yaml_config)
example seems
yamllint.linter.run
opens a given file.
It's misleading.
yamllint.linter.run("example.yaml", yaml_config)
example seems yamllint.linter.run
opens a given file.
It's misleading.
Hello,
I don't see how this could come from yamllint itself, my guess is that something mixes streams in your GitHub Actions.
I'm sorry but I don't know how to help here, but if anyone can, you'd better giving more context on how you're using GitHub Actions. I suggest sharing this on a community-powered Q&A service (e.g. Stack Overflow) on GitHub Actions / yamllint topics.
Hello,
It would need to be checked in the YAML specification, but I think name: @project.name@
is not valid YAML.
Could this Spring Boot format be a customized language, needing to be pre-processed before being YAML? It would be similar to Jinja2, or GitHub workflow languages: any YAML parser would fail to interpret such a file. See #61, #65, #128, #311, #408, #460, #462, #507...
In your specific case, maybe using quotes would work (name: "@project.name@"
).
Hello,
I guess Windows doesn't load your file with the correct encoding, so Python treats ä, ü, ö
as ä, ü, ö
.
Have you tried helping Windows/Python use the right encoding (I guess UTF-8)? I don't know much about Windows, but I just read you can use PYTHONUTF8=1
environment variable: https://dev.to/methane/python-use-utf-8-mode-on-windows-212i.
Hello, and thank you for this interesting proposal.
Yamllint is designed to be simple and minimal, mainly to achieve performance, stability and easy maintenance. Integration with git (or any other third-party tool) isn't likely to be added. Moreover (as you've correctly imagined), yamllint needs to run on whole files, otherwise YAML source cannot be safely parsed.
That being said, it would probably be easy to write a wrapper script around yamllint, that filters out any error that isn't in diffed portions. (:warning: If you do so, beware that in some situations, modifications to a file example.yaml
with a diff between lines 10…20 can trigger errors after line 20.)
Hello,
The fact that yamllint didn't complain about your YAML example before 1.29.0 was a bug, that @bcbrookman fixed in https://github.com/adrienverge/yamllint/pull/491.
Please see details there, but in short: either indent lines 3, 4, 8 and 9, or set indent-sequences: false
in your .yamllint.yaml
:
rules:
indentation:
indent-sequences: false
I guess the simplest implementation would answer "yes"? What do you think?
Hello,
Currently there isn't any yamllint rule that enforce such a notation.
Your "key-value pairs" example can be generalized with other types of data, which would give:
-
name: Mark McGwire
hr: 65
avg: 0.278
-
- nested
- list
-
string
-
[inline, sequence]
-
&anchor
{key: value}
Is this consistent with what you have in mind?
If yes, we could consider a new option (for example require-empty-first-line: true
) in the hyphens
rule.
Would you like to implement this?
Update to new upstream version
This new feature was just released in yamllint 1.29.0.
This new feature was just released in yamllint 1.29.0.
yamllint version 1.29.0
cli: Add --list-files command line option
This option lists the files to lint by yamllint, taking into account ignore
and yaml-files
configuration options.