CFLint
CFLint copied to clipboard
UNUSED_METHOD_ARGUMENT false positive
I'm getting this false positive using CFLint 1.4.0.
public boolean function getAPIVersion(
required numeric requestedAPIVersion
) cachedwithin=createTimeSpan(1,0,0,0) {
return (variables.availableAPIVersions.find(arguments.requestedAPIVersion) > 0) ?
arguments.requestedAPIVersion :
variables.availableAPIVersions[1];
}
[cflint] UNUSED_METHOD_ARGUMENT: Argument requestedapiversion is not used in function. Consider removing it.
CFParser is not parsing the
cachedwithin=createTimeSpan(1,0,0,0)
phrase correctly.
reference https://github.com/cfparser/cfparser/issues/106
@ryaneberly Good spot. I still get the false positive when there is no cachedWithin statement, though.
fixed in dev. added a test to cover this
@ryaneberly The expected test result doesn't seem right. Shouldn't bar
be reported for UNUSED_METHOD_ARGUMENT?
I've just tested on the latest snapshot, and even though the test in ReturnArg_573.cfc
is fine, the function in the opening post here is still reporting the issue.
Good point. @KamasamaK . Turns out it works if
) cachedwithin=createTimeSpan(1,0,0,0) returnformat="json"{
i.e. createTimespan() is not the last function qualifier.
reopening https://github.com/cfparser/cfparser/issues/106 and moving this to 1.6.0