varScoper 1.0 release
Today I am releasing version 1.0 of a project that I've been working on for a few weeks. It's a cfc that can be used to parse cfm and cfc files and identify variables that haven't been locally scoped within cffunctions.
varScoper can do the following....
- Find unscoped variables created with a cfset within a cffunction
- Find unscoped variables created with cftags (cfloop, cfquery, etc)
- Report line numbers and link directly to the line in the file
- Output to screen or csv
Hopefully everyone else will find this as useful as I do. There's a link in my projects section to the project page, or you can follow this link.
You might be surprised at the results you find. I've been careful to scope my vars within the last few years, but I found an alarming number of potential problems in some of the code I was writing a few years ago when I first started with CFCs. In any case, try downloading the sample code, run it against your codebase, and do some housecleaning.
Here's a screenshot


The only challange we ran into is that it does not work so well on a mac.. (or any UNIX system for that matter) I gets the /'s arround the wrong way :(
One caveat -- as far as I can tell, the code doesn't run out of the box on *nix systems, since you use '\' when recursing directories, instead of using the native os delimiter.
and could you make your lyla captcha all UPPCASE or lowercase - this would help.
One thing I found that is still missing is multi-line CFTAGs. e.g. Some of my code looks like below and CFScoper didn't point out the problem in var scope [i.e. retVar]:
----
<cfinvoke
webservice = "MyWebService"
method = "myMethod"
returnVariable = "retVar">
<cfinvokeargument name="nm" value="vl" />
</cfinvoke>
----