cfn-lint icon indicating copy to clipboard operation
cfn-lint copied to clipboard

Mixed identation checks

Open wieshka opened this issue 2 years ago • 3 comments

Is this feature request related to a new rule or cfn-lint capabilities?

No response

Describe the feature you'd like to request

Currently, if template file contains rather valid JSON, but with mixed use of identation, cfn-lint does not show that as an issue, whilst boto3/botocore validate_template call will fail.

Describe the solution you'd like

cfn-lint should be able to detect mixed identation use and advise on fixing.

Additional context

This was found whilst investigating https://github.com/Sceptre/sceptre/issues/1311 where cfn-linst, jq, and python -mjson.tool was used to validate early JSON, but all of them yielded that template is valid. cfn-lint should represent the same outcome as would botocore/boto3 iniated create stack which validates template.

Is this something that you'd be interested in working on?

  • [ ] 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • [ ] ⚠️ This feature might incur a breaking change

wieshka avatar Nov 06 '23 14:11 wieshka

Can you provide a little more detail so I can reproduce the issue?

I've tried to make the template at https://github.com/Sceptre/sceptre/issues/1311#issuecomment-1791501335 code fail a few different ways (validate and create stack APIs) and I haven't been successful.

kddejong avatar Nov 06 '23 16:11 kddejong

Seems that there was some github handling in the sample of mixed identiation, try with this one: https://gist.githubusercontent.com/wieshka/91d37fe765b2a1189fb3d80dff71f9ed/raw/33f1153c9d05ac2ef290d5187f203de38e1bf725/sample.json

wieshka avatar Nov 07 '23 12:11 wieshka

So downloaded that file and then ran aws cloudformation validate-template --template-body file://\~/Downloads/sample.json and got no errors. You said you are using boto3/botocore so you are just hitting the APIs directly. I can try that too.

kddejong avatar Nov 07 '23 16:11 kddejong