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

Argument appScope is not required and does not define a default value. #50

Closed
laserbyte opened this issue Apr 24, 2015 · 5 comments
Closed

Comments

@laserbyte
Copy link

I'm running the latest CFLint built from the source of the master branch. Here is my code from my Application.cfc.

<cffunction name="onSessionEnd" returnType="void" output="false">
    <cfargument name="sessionScope" type="struct" required="true">
    <cfargument name="appScope" type="struct" required="false">
</cffunction>
@ryaneberly
Copy link
Contributor

You are saying CFLint is not firing a ARG_DEFAULT_MISSING message, correct?

@laserbyte
Copy link
Author

Yes, apparently I misread the warning. As soon as I added a blank default the warning went away:

However from reading the documentation I'm not clear on what a reasonable default for the Application scope argument would be.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d40.html

In their examples they have it both ways but they don't say what a reasonable default should be.

@ryaneberly
Copy link
Contributor

ARG_DEFAULT_MISSING is an attempt to help ensure your API doesn't do something unexpected when the caller doesn't pass all the arguments.

We could disable this rule for the onXXX callback functions in Application.cfc.

Especially given the example in the Adobe docs..

What do you think?

@laserbyte
Copy link
Author

Honestly my preference would be to keep flagging the error, but just get some clarification from Adobe on what a reasonable default for the AppScope parameter actually is. Unfortunately the docs for 11 don't seem to be much better:

https://wikidocs.adobe.com/wiki/display/coldfusionen/onSessionEnd

@ryaneberly
Copy link
Contributor

I agree with keeping the flag as is.

I would argue that you should just make it required="true", instead of trying to figure out what a good default value would be.

This is a callback function from the system, and the system probably is going to be sending that 2nd parameter all of the time. It's going to be consistent anyway.

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