mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Coding Guidelines inconsistencies (#8481)
This commit is contained in:
parent
cb07e2ceba
commit
6b05da7632
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user