spectral icon indicating copy to clipboard operation
spectral copied to clipboard

Support for Cloudfomration custom tags or disabling default parser

Open p0o opened this issue 1 year ago • 2 comments

User story. As a developer, I can use spectral to lint Cloudformation YAML files (AWS IaC).

Is your feature request related to a problem? Cloudfomration uses custom tags like !Sub or !GetAtt which currently are not supported by default YAML parser and causes spectral to throw errors. It makes it unusable for this use case because enforcing it using CI causes correct Cloudformation templates to fail.

Sample error:

 error  parser                  Unknown tag <!Sub>

Describe the solution you'd like I like to be able to turn off the YAML parser error or be able to add YAML custom tags, through config file.

Additional context These are the current tags (intrinsic functions) AFAIK

        "!And sequence",
        "!If",
        "!If sequence",
        "!Not",
        "!Not sequence",
        "!Equals",
        "!Equals sequence",
        "!Or",
        "!Or sequence",
        "!FindInMap",
        "!FindInMap sequence",
        "!Base64",
        "!Join",
        "!Join sequence",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!Sub sequence",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!ImportValue sequence",
        "!Select",
        "!Select sequence",
        "!Split",
        "!Split sequence"```

p0o avatar Oct 09 '22 17:10 p0o

@p0o A concept where there's a file with a list of custom tags that the parser can ignore seems like a good idea. Would you mind contributing on this?

mnaumanali94 avatar Oct 20 '22 17:10 mnaumanali94

@mnaumanali94 I agree. Contribution on this require changes to @stoplight/yaml package right?

p0o avatar Oct 31 '22 04:10 p0o