CFLint icon indicating copy to clipboard operation
CFLint copied to clipboard

Determine if bug is in commented block

Open Vintic opened this issue 7 years ago • 1 comments

For example: for rule SelectStarChecker. Bug can be found in a commented block. <cfquery timeout="5"> <!--- SELECT * FROM bbb ---> SELECT a FROM bbb </cfquery>

Maybe we should on element.getContent() - remove all commented blocks, instantly. Using this RegExp .replaceAll("(<!---.*?--->|<!---.*|.*--->)","")

or before parsing document remove all comments. ( except those used by cflint )

Vintic avatar Dec 28 '18 07:12 Vintic

Hi again, I use this in CFLint.java file on line 274. String new_src = src.replaceAll("(?s)(<!---[\\s\\n]*)\\S(.*?--->)","$1 $2").replaceAll("(?s)(/\\*[\\s\\n]*)\\S(.*?\\*/)","$1 $2").replaceAll("(\\/\\/\\s*)\\S","$1 "); It replace all commented text with same number of character - spaces. But seems that sometimes it also report a bug in a commented code.

What I'm doing wrong?

Vintic avatar Jan 10 '19 07:01 Vintic