mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-17 13:38:18 +00:00
Replace GitHub-specific emoji names with emojis directly
This commit is contained in:
parent
12f5410bdb
commit
666d9f06a9
|
@ -30,17 +30,17 @@ With the exception of base/system.{h,cpp}
|
||||||
|
|
||||||
For single words
|
For single words
|
||||||
|
|
||||||
- `int length = 0;` :x:
|
- `int length = 0;` ❌
|
||||||
- `int Length = 0;` :white_check_mark:
|
- `int Length = 0;` ✅
|
||||||
|
|
||||||
For multiple words:
|
For multiple words:
|
||||||
|
|
||||||
- `int maxLength = 0;` :x:
|
- `int maxLength = 0;` ❌
|
||||||
- `int MaxLength = 0;` :white_check_mark:
|
- `int MaxLength = 0;` ✅
|
||||||
|
|
||||||
### Variable names should be descriptive
|
### Variable names should be descriptive
|
||||||
|
|
||||||
:x: Avoid:
|
❌ Avoid:
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
|
@ -55,7 +55,7 @@ for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
:white_check_mark: Instead do:
|
✅ Instead do:
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
for(int ClientId = 0; ClientId < MAX_CLIENTS; ClientId++)
|
for(int ClientId = 0; ClientId < MAX_CLIENTS; ClientId++)
|
||||||
|
@ -133,14 +133,14 @@ Do not use the `goto` keyword in new code, there are better control flow constru
|
||||||
|
|
||||||
Do not set variables in if statements.
|
Do not set variables in if statements.
|
||||||
|
|
||||||
:x:
|
❌
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
int Foo;
|
int Foo;
|
||||||
if((Foo = 2)) { .. }
|
if((Foo = 2)) { .. }
|
||||||
```
|
```
|
||||||
|
|
||||||
:white_check_mark:
|
✅
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
int Foo = 2;
|
int Foo = 2;
|
||||||
|
@ -161,13 +161,13 @@ Try finding descriptive names instead.
|
||||||
|
|
||||||
While the code base already has a lot of methods that start with a ``Get`` prefix. If new getters are added they should not contain a prefix.
|
While the code base already has a lot of methods that start with a ``Get`` prefix. If new getters are added they should not contain a prefix.
|
||||||
|
|
||||||
:x:
|
❌
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
int GetMyVariable() { return m_MyVariable; }
|
int GetMyVariable() { return m_MyVariable; }
|
||||||
```
|
```
|
||||||
|
|
||||||
:white_check_mark:
|
✅
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
int MyVariable() { return m_MyVariable; }
|
int MyVariable() { return m_MyVariable; }
|
||||||
|
@ -175,7 +175,7 @@ int MyVariable() { return m_MyVariable; }
|
||||||
|
|
||||||
### Class member variables should be initialized where they are declared
|
### Class member variables should be initialized where they are declared
|
||||||
|
|
||||||
Instead of doing this :x::
|
Instead of doing this ❌:
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
class CFoo
|
class CFoo
|
||||||
|
@ -184,7 +184,7 @@ class CFoo
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
Do this instead if possible :white_check_mark::
|
Do this instead if possible ✅:
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
class CFoo
|
class CFoo
|
||||||
|
@ -211,17 +211,17 @@ Use `bool` instead. And `true` means success and `false` means failure.
|
||||||
|
|
||||||
See https://github.com/ddnet/ddnet/issues/6436
|
See https://github.com/ddnet/ddnet/issues/6436
|
||||||
|
|
||||||
### filenames
|
### Filenames
|
||||||
|
|
||||||
Code file names should be all lowercase and words should be separated with underscores.
|
Code file names should be all lowercase and words should be separated with underscores.
|
||||||
|
|
||||||
:x:
|
❌
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
src/game/FooBar.cpp
|
src/game/FooBar.cpp
|
||||||
```
|
```
|
||||||
|
|
||||||
:white_check_mark:
|
✅
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
src/game/foo_bar.cpp
|
src/game/foo_bar.cpp
|
||||||
|
|
Loading…
Reference in a new issue