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

Named arguments in functions #182

Closed
edswifa opened this issue Jun 20, 2016 · 7 comments
Closed

Named arguments in functions #182

edswifa opened this issue Jun 20, 2016 · 7 comments

Comments

@edswifa
Copy link

edswifa commented Jun 20, 2016

I am getting Errors for named arguments in method calls. Can this be excluded or is it an issue.

Variable crid is not declared with a var statement. Use var or the local scope, or otherwise clarify the scope
In file CallPackageDao.cfc, line 247
In **********\object\cps\CallPackageDao.cfc
In function FindAllCallRates()
At line : 247
Expression: crid

The code parsed is shown below.

var callRate = getServiceLocator().get("object.cps.CallRate");
callRate.init(crid = CallRateId, newName = Name, newDescription = Description);
ArrayAppend(result, callRate);

I even get it with argumentcollection.

ryaneberly added a commit that referenced this issue Jun 21, 2016
@ryaneberly
Copy link
Contributor

I'm pretty certain this is fixed in the master branch. I added a test for this case in dev and it doesn't flag 'crid'

@edswifa
Copy link
Author

edswifa commented Jun 21, 2016

I'm definitley using CFLint-0.7.3-all.jar which was built from the master branch 2 days ago.
The error is showing for any code where I use a named argument.

Here is an example for argumentcollection.
`

    <cfscript>
        var result = variables.dao.FindCallPackageByProduct(argumentcollection = arguments);
    </cfscript>

    <cfreturn result />
</cffunction>`

`

`

@ryaneberly
Copy link
Contributor

Hmm, I'm having trouble duplicating it on my workstation. And the travis build didn't pick it up with the new test added. https://travis-ci.org/cflint/CFLint/branches

does this source file flag any MISSING_VAR for you?
https://github.com/cflint/CFLint/blob/dev/src/test/resources/com/cflint/tests/VarScoper/namedArgs.cfc

@edswifa
Copy link
Author

edswifa commented Jun 23, 2016

I'm running from the command line.

java -jar CFLint-0.7.3-all.jar -ui

Variable crid is not declared with a var statement. Use var or the local scope, or otherwise clarify the scope

In file namedArgs.cfc, line 4
In C:\Users\swifta\Documents\Downloads\namedArgs.cfc
In function x()
At line : 4
Expression: crid

I cant get the dev branch to build.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[11,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[12,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[19,22] cannot
find symbol
symbol: class Logger
location: class com.cflint.tools.CFLintFilter
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.304 s
[INFO] Finished at: 2016-06-23T13:50:01+01:00
[INFO] Final Memory: 16M/48M
[INFO] ------------------------------------------------------------------------

ryaneberly added a commit that referenced this issue Jun 30, 2016
ryaneberly added a commit that referenced this issue Jun 30, 2016
@ryaneberly
Copy link
Contributor

found it. sorry it took a while.

@edswifa
Copy link
Author

edswifa commented Jun 30, 2016

Just tried to build the dev branch and got a failure so I cant check your fix.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[11,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[12,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[19,22] cannot
find symbol
symbol: class Logger
location: class com.cflint.tools.CFLintFilter
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.600 s
[INFO] Finished at: 2016-06-30T13:10:26+01:00
[INFO] Final Memory: 16M/48M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project C
FLint: Compilation failure: Compilation failure:
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[11,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[12,17] package
org.slf4j does not exist
[ERROR] /C:/Users/swifta/Documents/Downloads/CFLint-dev/src/main/java/com/cflint/tools/CFLintFilter.java:[19,22] cannot
find symbol
[ERROR] symbol: class Logger
[ERROR] location: class com.cflint.tools.CFLintFilter
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@edswifa
Copy link
Author

edswifa commented Jun 30, 2016

Ignore my last message.
I got it to build after deleting the whole directory and performing another clean install.

The issue is resolved, no longer reporting var scope error for named arguments.

Thanks for your help.

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

2 participants