SkaceKamen / vscode-sqflint

SQF Language server extension
MIT License
19 stars 9 forks source link

False positives when callback scopes are involved #122

Open mwpowellhtx opened 2 years ago

mwpowellhtx commented 2 years ago

In our scenario, we architect some callbacks and so forth, inversion of control patterns.

// calling context function _a
private _c = { ... };
[_c] call _b; // invokes _b with _c callback, which _b may define some vars that _c may use

_b may define some variables that, by design, we 'agree' should be there.

LINT sees vars in _c, defined in _b context, as possibly undefined. Which possibly they are, but for design time decisions we have made by agreement.

Functions may be module compiled, ad hoc, or whatever; does not matter, the pattern is there, I think.

According to SQF scope rules, AFAIK, that is perfectly fine. However, not sure how the linter will deal with that exactly, but that is the scenario.

Otherwise, I think I understand what the linter is telling me as being false positives, but it is good to know. And it seems to do a pretty decent job also picking up included headers, macro definitions, and so forth, otherwise.

HTH and thank you!