Coding Guidelines inconsistencies (#8481)

This commit is contained in:
Whigital 2021-10-05 19:20:52 +02:00 committed by GitHub
parent cb07e2ceba
commit 6b05da7632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,17 +463,17 @@ Good:
```js ```js
if (call FUNC(myCondition)) then { if (call FUNC(myCondition)) then {
private _areAllAboveTen = true; // <- smallest feasable scope private _areAllAboveTen = true; // <- smallest feasable scope
{ {
if (_x >= 10) then { if (_x >= 10) then {
_areAllAboveTen = false; _areAllAboveTen = false;
}; };
} forEach _anArray; } forEach _anArray;
if (_areAllAboveTen) then { if (_areAllAboveTen) then {
hint "all values are above ten!"; hint "all values are above ten!";
}; };
} }
``` ```
@ -482,15 +482,15 @@ Bad:
```js ```js
private _areAllAboveTen = true; // <- this is bad, because it can be initialized in the if statement private _areAllAboveTen = true; // <- this is bad, because it can be initialized in the if statement
if (call FUNC(myCondition)) then { if (call FUNC(myCondition)) then {
{ {
if (_x >= 10) then { if (_x >= 10) then {
_areAllAboveTen = false; _areAllAboveTen = false;
}; };
} forEach _anArray; } forEach _anArray;
if (_areAllAboveTen) then { if (_areAllAboveTen) then {
hint "all values are above ten!"; hint "all values are above ten!";
}; };
}; };
``` ```
@ -575,8 +575,8 @@ Good:
```js ```js
fnc_example = { fnc_example = {
params ["_content"]; params ["_content"];
hint _content; hint _content;
}; };
``` ```
@ -719,7 +719,7 @@ _a pushBack _value;
Also good: Also good:
```js ```js
_a append [1,2,3]; _a append [1, 2, 3];
``` ```
Bad: Bad: