Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqf: prevent changing reserved variables #804

Merged
merged 3 commits into from
Oct 19, 2024
Merged

Conversation

BrettMayson
Copy link
Owner

@BrettMayson BrettMayson commented Oct 19, 2024

image

Copy link

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
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
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
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
34 of 37 checks passed
@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