Open jaredbeck opened 4 years ago
A more complete example:
<cffunction name="f">
<cfquery>
<cfloop list="a,b,c" index="local.x">
#x#
</cfloop>
</cfquery>
</cffunction>
Message code:UNUSED_LOCAL_VARIABLE
File:redacted.cfm
Column:11
Line:3
Message:Local variable x is not used in function f. Consider removing it.
Variable:'x' in function: f
Expression:x
For comparison, the following passes:
<cfset var x = 0>
<cfloop list="a,b,c" index="x">
To further simplify the example:
<cffunction name="f">
<cfset var x = 0>
<cfquery datasource="#request.app_datasource#">
#x#
</cfquery>
</cffunction>
It seems that using a variable in cfquery
is not recognized.
This issue is very similar to https://github.com/cflint/CFLint/issues/632. If it's helpful to you to combine them, @ryaneberly, please feel free to.
Can confirm this happens when in script syntax as well. In this example, header
will trigger the rule.
for( var header in requestHeaders ){
cfhttpparam( type = 'header', name = header.name, value = header.value );
}
Also ocures when using cfhttp()
.
var fullURL = 'https://www.google.com/';
cfhttp( URL = fullURL, result = 'myResult' ){ ..... };
EDIT: better example below
Possibly related to https://github.com/cflint/CFLint/issues/657