Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent local variable detection? #713

Open
nukleos opened this issue Oct 4, 2021 · 0 comments
Open

Inconsistent local variable detection? #713

nukleos opened this issue Oct 4, 2021 · 0 comments

Comments

@nukleos
Copy link

nukleos commented Oct 4, 2021

Here’s a tiny component to demonstrate what I consider to be an inconsistency in CFLint.

<cfcomponent name="CFLintTest" output="false" hint="A testcase for CFLint." >
    <cffunction name="testLocalVar" returntype="void" access="public" output="false" hint="Testing...">
        <cfset var someoutput = "" />
        <cfexecute name="test.exe" variable="someoutput" timeout="10" />
    </cffunction>
<cfcomponent>

In this form, CFLint will complain with this message “Local variable someoutput is not used in function testLocalVariable. Consider removing it ( UNUSED_LOCAL_VARIABLE )”. OK, let’s do that.

<cfcomponent name="CFLintTest" output="false" hint="A testcase for CFLint." >
    <cffunction name="testLocalVar" returntype="void" access="public" output="false" hint="Testing...">
        <cfexecute name="test.exe" variable="someoutput" timeout="10" />
    </cffunction>
<cfcomponent>

But when you delete the line that defines the local variable, you’ll get another error message, saying “Variable someoutput is not declared with a var statement ( MISSING_VAR )”.

So in the second situation it will detect the fact that ‘someoutput’ is a local variable, while that’s not the case in the first. Strange, yes. A bug ? Possibly…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant