Open mwpowellhtx opened 1 year ago
So, when I use the correct macro, then I get warning, again, seems like a false positive.
private _unitPos = [_mission] call _calculateContainerUnitPos;
HTRES_SET(_target,_unitPos);
// Expanded code equivalent:
_target setVariable ["KPLIB_htres" + "_unitPos", _unitPos];
// ^^^^^^^^
The warning:
[{
"resource": "/l:/Source/Arma/Arma 3/KP-Liberation/kp-lib-refactor-mwpowellhtx/Missionframework/modules/0936_htres/fnc/fn_htres_onStartingCalculateContainerUnitPos.sqf",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 4,
"message": "Possibly undefined variable var",
"source": "sqflint",
"startLineNumber": 48,
"startColumn": 49,
"endLineNumber": 48,
"endColumn": 52
}]
Which I suppose is a plausible warning, but even when I feed _unitPos
a hard, not assumed functional return, value, I get the same thing, i.e.
_unitPos = 1;
Yea the macro expansion is very rough (it's incomplete, I know), I'll look into it if I have time but no promise :)
No worries, thanks. Some of it here was my own confusion, includes, definitions, etc. But there are still 'moments'. Thanks...
Also maybe a helpful take away... Do A3 SQF includes benefit from header guards in the same way that C/C++ headers have guards? i.e.
#ifndef SUCHANDSUCH
#define SUCHANDSUCH
#endif // SUCHANDSUCH
This did not appear to be an issue a day or so ago, unless possibly there was a dependency update or something like that. I have not investigated that aspect. Currently running
v0.12.1
although apparently the latest documented branch isv0.12.0
maybe that was never pushed, I do not know.Okay, on with the specific report. Have some macro definitions, i.e.
And in the SQF code:
And as far as I can tell the same line in natural language form, not macro code generated, is fine.
But that's sort of the point, the macro shorthand, to save a breath and/or a keystroke or two and not get stuck in the weeds of the longhand, needs to be dependable without throwing spurious false positives. Illustration below; I'll walk you through it.
_mission
. Have verified that the call works, yields correct results, although LINT is not a runtime thing, so would not know this._unitPos
should be expanding as"KPLIB_htres_unitPos"
variable on the_target
object. Again, appears fine in natural language form, but seems to have broken in some recent version of LINT and/or one of its dependencies.And for reference purposes, identifying the
_target
object correctly from the_mission
object. Have verified I have both.And the error:
I have no idea what this means, it certainly seems to be a false positive, maybe a white space issue, who knows.
Current
vscode
details, yes, I know, a bit behind the current1.74.1
whatever it is, but still, the actualsqflint
plugin has not changed, unless maybe one of its feature dependencies has changed from under it.