Skip to content

sqf: prevent changing reserved variables#804

Merged
BrettMayson merged 3 commits intomainfrom
sqf_reserved_variables
Oct 19, 2024
Merged

sqf: prevent changing reserved variables#804
BrettMayson merged 3 commits intomainfrom
sqf_reserved_variables

Conversation

@BrettMayson
Copy link
Copy Markdown
Owner

@BrettMayson BrettMayson commented Oct 19, 2024

image

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 19, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 40 lines in your changes missing coverage. Please review.

Project coverage is 68.3%. Comparing base (faaccb2) to head (cee099c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...rc/analyze/lints/s23_reassign_reserved_variable.rs 79.7% 40 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
libs/sqf/src/analyze/lints/s18_in_vehicle_check.rs 73.3% <100.0%> (ø)
libs/sqf/src/analyze/lints/s22_this_call.rs 74.1% <ø> (ø)
...rc/analyze/lints/s23_reassign_reserved_variable.rs 79.7% <79.7%> (ø)

@PabstMirror
Copy link
Copy Markdown
Collaborator

~20 hits in CBA (although mostly in test funcs)
macro DEFAULT_PARAM triggers it

DEFAULT_PARAM(2,_resolution,10);

#define DEFAULT_PARAM(INDEX,NAME,DEF_VALUE) \
    private [#NAME,"_this"]; \
    ISNILS(_this,[]); \
    NAME = _this param [INDEX, DEF_VALUE]; \
    TRACE_3("DEFAULT_PARAM",INDEX,NAME,DEF_VALUE)

#define ISNILS(VARIABLE,DEFAULT_VALUE) if (isNil #VARIABLE) then { VARIABLE = DEFAULT_VALUE }

maybe warning instead of error?

@PabstMirror
Copy link
Copy Markdown
Collaborator

PabstMirror commented Oct 19, 2024

tag PR #802
need to protect _this

@BrettMayson BrettMayson marked this pull request as draft October 19, 2024 01:55
@BrettMayson
Copy link
Copy Markdown
Owner Author

BrettMayson commented Oct 19, 2024

Should also cover params

@BrettMayson BrettMayson marked this pull request as ready for review October 19, 2024 02:35
@BrettMayson BrettMayson merged commit f6e2d3a into main Oct 19, 2024
@BrettMayson BrettMayson deleted the sqf_reserved_variables branch October 19, 2024 02:54
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

Successfully merging this pull request may close these issues.

2 participants