Skip to content

Minor update to varscoper

by Mike on December 6, 2007

I just released a 1.12 update to my varscoper tool.  I’ve added new tags to the parsing engine, added XML output support, and fixed some bugs related to directory parsing in CF6.  Thanks to Kola Oyedegi for help with XML output and Dmitriy Goltseker for fixing directory processing.  Thanks to everyone who helped to refine the list of tags that create variables.  The additions are below.  You can also download 1.12 here , or get it via SVN on riaforge.

  • cfhttp:result
  • cfquery:result
  • cfimage:name
  • cfmail:query
  • cffeed:name
  • cffeed:query
  • cfftp:name
  • cfwddx:output
  • cfobject:name
  • cfsearch:name
  • cfprocresult:name
  • cfpop:name
  • cfregistry:name
  • cfreport:name
  • cfdbinfo:name
  • cfdocument:name
  • cfexecute:variable
  • cfNtAuthenticate:result
  • cfcollection:name
  • cfpdf:name
  • cfxml:variable
  • cfzip:name
  • cfldap:name

From → varscoper

9 Comments
  1. Excellent work, Mike. Thanks!

  2. Thanks for the update to an excellent tool

  3. Hi Mike,

    Just wanted to say thanks again for such a great tool, I’ve been using it for a while and it’s fast becoming an essential part of my toolkit.

    Nice work :)

  4. Sorry, bit behind the times with checking this out. Great tool. I have been using variables inside my functions like this:

    <cfset var private = StructNew() />
    <cfset var private.muppet = "animal" />
    <cfset var private.instrument = "drums" />

    Is this acceptable practice as varScope is flagging these up.
    Thanks

  5. Ignore the above what I meant to say was…

    I have been using variables inside my functions like this:

    <cfset var private = StructNew() />
    <cfset private.muppet = "animal" />
    <cfset private.instrument = "drums" />

    Is this acceptable practice as varScope is flagging these up.
    Thanks!

  6. John-
    Do you have a code example that you can provide that shows a case where varscoper flags an unscoped var? I just copied and pasted that code snippet into the tool and it didn’t report any issues (as it should). The code is scoped appropriately, maybe there’s a typo in the code that you are seeing results in.

    -Mike

  7. Gualtiero Sappa permalink

    Hi Mike,
    first of all thanks for this excellent tool!

    I tested this case:

    <cfquery name="#queryname#" datasource="#arguments.dbprop.dsn#">

    and varscoper report #queryname# as unscoped

    I resolved changing following row

    <cfset variableNameIsolationString = trim(ReReplaceNoCase(variableNameIsolationString,’["''=]‘,"","all"))>

    in

    <cfset variableNameIsolationString = trim(ReReplaceNoCase(variableNameIsolationString,’["''=##]‘,"","all"))>

    Hope that helps

  8. Gualtiero-

    Be very careful with that one, in your example, "queryname" is not actually the variable that needs to be scoped, the variable to be scoped would be the value of the variable name "queryname". i.e. if queryname=foo then foo is the variable that should have the var statement set. I’ve come across this case before and I decided to leave it in because as far as I know you can’t dynamically scope a variable as local to the function. Technically, varScoper would need to know the value of queryname, and we wouldn’t be able to do that until runtime.

    -Mike

  9. Gualtiero Sappa permalink

    Mike,
    you are right. From this point of view my change doesn’t have sense!

    Thank you for your response.

    Bye

    Gualtiero

Comments are closed.