ColdFusion Muse

Var Scoper Tool

Mike Henke reminded me of this slick little tool called varscoper. Pass in a directory and it will ferret out all the places where variables are not correctly scoped. For example, it will sshow where you have not correctly var'ed variables in a function. The project was produced by Mike Schierberl who's blog has some excellent goodies and tips.

varscoper won't catch the cfhttp scope, but it would catch a variable declared as a result attribute. Either way, it could save you some headaches - especially when dealing with a large pool of code, or taking over someone else's code.

Related Blog Entries

Comments
Mike Schierberl's Gravatar A quick note on the cfhttp issue, if you specify a result attribute for your cfhttp call it will scan that as an unscoped variable.

You are correct that it will ignore cfhttp variables. This scope was marked as an ignored scope originally and I'll probably change that in the next release. For now, you can remove cfhttp from the list of ignored scopes on line 47 of varscoper.cfc
# Posted By Mike Schierberl | 6/19/08 1:47 PM



Blog provided and hosted by CF Webtools. Blog Sofware by Ray Camden.