BrettMayson / HEMTT

Build System for Arma 3
http://hemtt.dev/
GNU General Public License v2.0
114 stars 40 forks source link

sqf: prevent changing reserved variables #804

Closed BrettMayson closed 3 weeks ago

BrettMayson commented 3 weeks ago

image

codecov[bot] commented 3 weeks ago

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 :warning:
Additional details and impacted files | [Files with missing lines](https://app.codecov.io/gh/BrettMayson/HEMTT/pull/804?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brett) | Coverage Δ | | |---|---|---| | [libs/sqf/src/analyze/lints/s18\_in\_vehicle\_check.rs](https://app.codecov.io/gh/BrettMayson/HEMTT/pull/804?src=pr&el=tree&filepath=libs%2Fsqf%2Fsrc%2Fanalyze%2Flints%2Fs18_in_vehicle_check.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brett#diff-bGlicy9zcWYvc3JjL2FuYWx5emUvbGludHMvczE4X2luX3ZlaGljbGVfY2hlY2sucnM=) | `73.3% <100.0%> (ø)` | | | [libs/sqf/src/analyze/lints/s22\_this\_call.rs](https://app.codecov.io/gh/BrettMayson/HEMTT/pull/804?src=pr&el=tree&filepath=libs%2Fsqf%2Fsrc%2Fanalyze%2Flints%2Fs22_this_call.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brett#diff-bGlicy9zcWYvc3JjL2FuYWx5emUvbGludHMvczIyX3RoaXNfY2FsbC5ycw==) | `74.1% <ø> (ø)` | | | [...rc/analyze/lints/s23\_reassign\_reserved\_variable.rs](https://app.codecov.io/gh/BrettMayson/HEMTT/pull/804?src=pr&el=tree&filepath=libs%2Fsqf%2Fsrc%2Fanalyze%2Flints%2Fs23_reassign_reserved_variable.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brett#diff-bGlicy9zcWYvc3JjL2FuYWx5emUvbGludHMvczIzX3JlYXNzaWduX3Jlc2VydmVkX3ZhcmlhYmxlLnJz) | `79.7% <79.7%> (ø)` | |
PabstMirror commented 3 weeks ago

~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 commented 3 weeks ago

tag PR https://github.com/BrettMayson/HEMTT/pull/802 need to protect _this

BrettMayson commented 3 weeks ago

Should also cover params