Determine if bug is in commented block
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 )
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?