Workaround for Cfscript Bug in Varscoper

Those that use the sensational varscoper tool from Mike Schierberl know that cfscript is still a little experimental with the current release.

One of the things it can do is return variables that are actually “var” scoped as not var scoped when using cfscript. This seems to happen most often when you have a comment directly above the variable in question.

1
2
3
4
5
6
7
<cfscript>

  var column = 2;       //which column the pod is in
  var row = 3;      //which row the pod is on
  var newRow = 0;

</cfscript>

In the above example Varscoper tells me that “newRow” is not var scoped when clearly it is.

This is usually fine, but if you start to get a lot of these false positives there is a quick little workaround. Place a semi-colon at the end of the last comment which effectively tells varscoper where the statement finishes and fixes the problem.

1
2
3
4
5
6
7
<cfscript>

  var column = 2;       //which column the pod is in
  var row = 3;      //which row the pod is on;
  var newRow = 0;

</cfscript>

Note the semi-colon after the 2nd comment. Now my reports are nice and clean :)

Comments