fix yamllint errors specific for Prometheus.yml

569 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Mar 23, 2021, 9:39:57 AM3/23/21
to Prometheus Users
Hi

promtool check config doesn't complain, but yamllint prints several issues:

https://cryptpad.fr/pad/#/2/pad/view/icFsx9ZE8U5LHYWyMAvIUbZxsvnpFL34eL4hI0wVfFg/embed/

warning missing document start "---" (document-start)

wrong indentation: expected 2 but found 0 (indentation)

line too long (327 > 80 characters) (line-length)

warning comment not indented like content (comments-indentation)

How-To fix those errors automatically? I tried "yq" pretty print, but he
reports show same errors.

What tools do you use for auto-format?
With Google I often find a Visual Studio Code plugin, but I prefer a
command line solution (one liner shell).

best regards
Eveyln
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Matt Zagrabelny

unread,
Mar 23, 2021, 9:46:14 AM3/23/21
to Evelyn Pereira Souza, Prometheus Users
On Tue, Mar 23, 2021 at 8:39 AM 'Evelyn Pereira Souza' via Prometheus Users <promethe...@googlegroups.com> wrote:
Hi

promtool check config doesn't complain, but yamllint prints several issues:

https://cryptpad.fr/pad/#/2/pad/view/icFsx9ZE8U5LHYWyMAvIUbZxsvnpFL34eL4hI0wVfFg/embed/

warning  missing document start "---"  (document-start)

wrong indentation: expected 2 but found 0  (indentation)

line too long (327 > 80 characters)  (line-length)

$ cat ~/.config/yamllint/config
rules:
    line-length: disable

I'm guessing there may be config options for the other warnings, too.
 
-m

Evelyn Pereira Souza

unread,
Mar 23, 2021, 11:22:46 PM3/23/21
to Matt Zagrabelny, Prometheus Users
On 23.03.21 14:45, Matt Zagrabelny wrote:
> $ cat ~/.config/yamllint/config
> rules:
>     line-length: disable
>
> I'm guessing there may be config options for the other warnings, too.
> -m

Hi

Thanks. But I wish not to exclude the error, I wish to automatically fix
the errors with a tool.

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

David Leadbeater

unread,
Mar 24, 2021, 9:37:57 AM3/24/21
to Evelyn Pereira Souza, Matt Zagrabelny, Prometheus Users
On Wed, 24 Mar 2021 at 03:22, 'Evelyn Pereira Souza' via Prometheus Users <promethe...@googlegroups.com> wrote:
[...]
Thanks. But I wish not to exclude the error, I wish to automatically fix
the errors with a tool.

It looks like yamllint doesn’t plan to add support for automatic fixing: 

I’ve not used it but 
https://github.com/jumanjihouse/pre-commit-hook-yamlfmt looks like it could be useful for you.

Evelyn Pereira Souza

unread,
Mar 25, 2021, 10:09:41 AM3/25/21
to promethe...@googlegroups.com
On 24.03.21 14:37, David Leadbeater wrote:
> I’ve not used it but
> https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
> <https://github.com/jumanjihouse/pre-commit-hook-yamlfmt> looks like it
> could be useful for you.
Thank you. This tool did very well the job and the result was compatible
with Prom.

But I can't force everybody else to install pre-commit hooks on their
machine.

Any other solution?

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages