yamllint icon indicating copy to clipboard operation
yamllint copied to clipboard

Rule 'comments' should ignore Cloud-Init "#cloud-config" similar to shebangs

Open lwbt opened this issue 4 years ago • 4 comments

I noticed that shebangs can be configured to be ignored in recent versions. Cloud-Init has a similar string at the start of a document which should be also ignored: #cloud-config

https://cloudinit.readthedocs.io/en/latest/topics/examples.html?highlight=%23cloud-config

lwbt avatar Feb 23 '21 12:02 lwbt

It makes sense. However there will probably be other magic values #foo in the future. Maybe the best would be to specify the list of regex to ignore?

rules:
  comments:
    require-starting-space: true
    ignore-regex:
      - ^#!
      - ^#cloud-config
    min-spaces-from-content: 2

adrienverge avatar Feb 23 '21 13:02 adrienverge

That would be even better, yes.

lwbt avatar Feb 23 '21 13:02 lwbt

It looks like another user would like the same thing: https://github.com/adrienverge/yamllint/issues/416.

Contributions are welcome!

adrienverge avatar Oct 26 '21 10:10 adrienverge

Another example of this would be sops encrypted comments which look like:

    #ENC[AES256_GCM,data:XXXXXXXXXXXXXXX,iv:YYYYYYYYYYYYYYYY,tag:ZZZZZZZZZZZZZZ,type:comment]

james-callahan avatar Aug 16 '22 07:08 james-callahan

Closing in favor of https://github.com/adrienverge/yamllint/issues/545.

adrienverge avatar Mar 08 '23 17:03 adrienverge