adrienverge / yamllint

A linter for YAML files.
GNU General Public License v3.0
2.9k stars 278 forks source link

yamllint should provide meaningful output if no results found #664

Closed dheerajkumar23 closed 7 months ago

dheerajkumar23 commented 8 months ago

yamllint -d "{rules: {anchors: {forbid-undeclared-aliases: true, forbid-duplicated-anchors: true, forbid-unused-anchors: true}}}" values.yaml

In this case, if it doesn't find anything useful it doesn't print back anything. However, a meaningful message could be helpful

andrewimeson commented 8 months ago

This is standard behavior for most command line utilities, especially on Linux and UNIX systems. See the Rule of Silence.

I could see a benefit to a verbose mode flag that would output something at the end like this

23 files checked
0 warnings
0 errors
dheerajkumar23 commented 8 months ago

What is verbose mode tag for yamllint? Mostly, it is -v and even when I ran yamllint --help there is no tag for versbose mode...

andrewimeson commented 8 months ago

The verbose flag doesn't exist for yamllint, I meant to suggest that maybe it should -v is used for printing the version in yamllint, so it would probably need to be -V (or --verbose for the long form). I don't see multiple levels of verbosity being needed like some utilities (e.g. curl) provide.

dheerajkumar23 commented 8 months ago

Thanks @andrewimeson. That's what is the issue all about. And today I found one more issue @adrienverge which is that when we run yamllint using subprocress in python. If it catches an error it will be stored from subprocess as stdout() not sterr() which is very confusing as it is seemingly throwing an error then why it is not able to catch it. But this issue could be with subprocess library as well. I am not sure which one is responsible :(

adrienverge commented 8 months ago

If such an option existed, it could be named --summary. But like @andrewimeson pointed out, this is standard behavior amongst UNIX tools; I support this Rule of Silence and I'm in favor of simplicity.

Depending on the need, alternatives can be yamllint --list-files . to check that yamllint would actually process files, or yamllint --list-files . | wc -l to know the number of files checked, for instance.

dheerajkumar23 commented 7 months ago

Closing the issue as I don't think any action can be taken.