commandbox-cfformat icon indicating copy to clipboard operation
commandbox-cfformat copied to clipboard

check tag do check html balance on top of tag balance

Open xdecock opened this issue 5 years ago • 3 comments

<cfif test()>
<div class="wrapper">
</cfif>
<cfif test()>
</div>
</cfif>

This will fail the check-tag to be honnest no certain how to fix this.

xdecock avatar Jun 13 '20 10:06 xdecock

@xdecock Yeah, I knew when I created this command that code like that would be an issue for it. I have such structures in my own code as well. But I don't know that there is a way to fix it, given how CFML and HTML can be intermixed. It occurred to me to just check CFML and HTML tags separately, but then the following structure will not be flagged:

<cfoutput>
<div>
</cfoutput>
</div>

I would like to catch situations like this (even though I know it is not a "real" issue) - whatever direction the tool goes, it is going to be imperfect.

jcberquist avatar Jun 18 '20 16:06 jcberquist

Maybe, list "orphan nodes" and allow them to match if they're at the same depth?

xdecock avatar Jun 18 '20 16:06 xdecock

I just found cfformat and started using it and I am running into this as well.

KrunchMuffin avatar Dec 13 '21 23:12 KrunchMuffin