question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New MISSING_VAR false positives in 1.3.0 around cfscript/tag syntax

See original GitHub issue

ACF, here are a few examples of new false positives (150+ in my codebase) I just found 😕

They never triggered false positives in 1.2.x. but do now in 1.3+

var qGetSites = new Query(datasource="...", sql="...");

Variable datasource is not declared with a var statement, same for “variable” sql.

var mailService=new mail(
                    to="...",
                    from="...",
                    subject="...",
                    type="HTML",
                    body=mailBody
                    );

all 5 valid attributes here trigger now MISSING_VAR

var httpRequest = new HTTP(
        method = "get",
        url = ("http://api.pusherapp.com" & resourceUri),
        charset = "utf-8"
            );

method and charset trigger a MISSING_VAR, url doesn’t. No idea why.

var httpRequest = new Http(method=arguments.method, url=variables.ENDPOINT & arguments.resourceUri, charset="utf-8", timeout=arguments.timeout, throwOnError=false, username=variables.something, password=variables.somethingelse, getAsBinary="never");

charset, throwOnError, username, password, getAsBinary trigger MISSING_VAR

application.facebookSDK.facebookApp = new facebook.sdk.FacebookApp(appId=application.config.FBPhotoEndpoint_APPID, secretKey=application.config.FBPhotoEndpoint_SECRET_KEY, apiVersion=application.config.FBPhotoEndpoint_Version);

Reports MISSING_VAR on each of the constructor arguments appId, secretKey, apiVersion

void function setCallerVars(data, row, getRow, columnNames){
        var rowData = getRow(data, row, columnNames);
        for (var col in listToArray(columnNames)){
        	if (isQuery(data) && ListFindNoCase(data.columnList, col)) {
				caller[col] = rowData[col];
        	}
        }
        caller["currentRow"] = currentRow;
    }

The above is in a custom tag. Reports on “caller” for MISSING_VAR. “Caller” is a scope similar to thisTag in a custom tag and should then not report MISSING_VAR.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
TheRealAgentKcommented, Jan 11, 2018

Pretty sure I got the issue with a local build of the dev branch. Your tests look like my scenarios - I’ll look closer into that later today or on the weekend - weird.

0reactions
ryaneberlycommented, May 11, 2018

I think this can be closed and included in 1.4.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

CFLint/CHANGELOG.md at master
#524; New MISSING_VAR false positives in 1.3.0 around cfscript/tag syntax #517; Component path not recognized as valid return type #500 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found