CFLint icon indicating copy to clipboard operation
CFLint copied to clipboard

New Rule: Report missing cfargument when it is dereferenced.

Open bardware opened this issue 8 years ago • 0 comments

I did some copy-paste programming.

I have a cffunction and a cfargument and use the argument in a cfquery

  <cffunction name="myFunc" access="public" returntype="query" output="false">
    <cfargument name="iBooking" type="numeric" required="true">
    <cfargument name="iLang" type="numeric" required="true" hint="language">

    <cfquery name="local.myQuery" datasource="#Application.datasource#">
        SELECT	col1
        FROM	table
        WHERE	lang = <cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.lang#">
    </cfquery>

    <cfreturn local.myQuery>
  </cffunction>

CFLint nicely tells me I don't use my iLang argument (UNUSED_METHOD_ARGUMENT ) but does not inform me there's no cfargument for lang which I try to access in the query.

I know, cfargument tags are purely optional but I'd love to be informed if there's a deviation between the arguments I declare and the arguments I use.

bardware avatar Sep 27 '17 15:09 bardware