The rule cpp:S6004 “Use the init-statement to declare “useAircraftAsRotations” inside the if statement.” triggers on variables that would otherwise fit the pattern, but are static. Static variables can not be declared in the init statement.
I had a quick look at the C++ Standard for the if statement . After following the simple-declaration link a few steps it allows a storage-class-specifier, which would allow static.
I’ve tested with Godbolt and all mainstream compilers accept the static. (Note that dois a keyword, so I renamed the function.)
Can you explain why you believe static variables can’t be declared in the init-statement?