Open baurmatt opened 5 months ago
Hello Matthias, thanks for the clear explanation, with a reproducer :+1:
(I think you added rm .yamllint
by mistake)
With this configuration:
extends: default
ignore: test.yaml
test.yaml
is correctly ignored when running yamllint in "file discovery" mode, e.g. yamllint .
. But it is debatable that test.yaml
should be ignored when it is passed explicitely as a cli argument, e.g. yamllint test.yaml
. https://github.com/adrienverge/yamllint/pull/654 fixed a strange behavior about symbolic links, and this one at the same time.
May I ask how you encounter the problem? How you call yamllint? With the failing YAML file passed as an explicit argument?
I'm not sure whether the old or the new behavior is better. On the one hand, it doesn't make sense to ignore a file that is explicitely passed as argument to the command. But on the other hand, doing is more consistent between how the global ignore
and the per-rule ignore
work:
extends: default
ignore: test.yaml
rules:
key-duplicates:
ignore: test.yaml
(in the above example, key-duplicates
will ignore test.yaml
, whether it's linted with yamllint .
or yamllint test.yaml
)
Same problem here. This .yamllint code block
ignore: |
.clang-format
.clang-tidy
.yamllint
Is not ignoring the files correctly, as in my pre-commit run, the file is not ignored:
Checking and linting yaml files internals................................Failed
.clang-format 52:141 error line too long (694 > 140 characters) (line-length) 55:141 error line too long (767 > 140 characters) (line-length)
I'm having the same problem. I got a clang-format line, which exceeds 140 characters. It should be ignored by the yamllint. But it is not ignored in my Jenkins, and it is braking the build.
ignore: | .clang-format .clang-tidy .yamllint
The version working version is: 1.31
Luis, Carlos, same question: how do you encounter the problem? How do you call yamllint? With the failing YAML file passed as an explicit argument?
Hi Adrien,
we currently use the following call for yamllint that is explict:
find . -type f \( -name '*\.yaml' -or -name '*\.yml' \) -and -not \( -path './*templates/*' -or -name '*helmfile.yaml' \) -print0 | xargs -0 yamllint
/cc @baurmatt
@adrienverge We got a pipline on a Jenkins which uses pre-commit. On the pre-commit config we got this section:
[options]
packages = find:
install_requires =
mdformat-myst>=0.1.5
yamlfix>=1.9.0
yamllint>=1.31.0
cmakelang>=0.6.13
python_requires = >=3.8
Each time that the Jenkins is execute it clears the pre-commit and updates the hooks. This morning was failing and we have fixied the problem doing this:
packages = find:
install_requires =
mdformat-myst>=0.1.5
yamlfix>=1.9.0
yamllint==1.31.0
cmakelang>=0.6.13
python_requires = >=3.8
@hardoverflow thanks, this is indeed a use-case that seems legitimate. I created https://github.com/adrienverge/yamllint/pull/658 to restore the previous behavior, and released it in yamllint version 1.35.1.
Thanks for the quick response and the bug fix. Thanks also for such a great tool! From my point of view, the issue can be closed. The bugfix works as expected.
Hey,
first of all: thanks for this project! Basically all of our CI pipelines use it! :)
Sadly we found that the latest (1.35.0) release broken the "Ignoring paths" feature which we use to get some of your pipeline green :) I've created a reproduction case in the hope that this helps to narrow down the problem:
Thanks!
Regards, Matthias