mirror of
https://github.com/ddnet/ddnet.git
synced 2024-10-18 06:53:43 +00:00
deen's tweaks in CONTRIBUTING.md
Co-authored-by: Dennis Felsing <dennis@felsing.org>
This commit is contained in:
parent
77cee822a7
commit
0aa6cfc307
|
@ -1,23 +1,23 @@
|
||||||
# Contributing code to ddnet
|
# Contributing code to DDNet
|
||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
||||||
Please open issues first discussing the idea before starting to write code.
|
Please open an issue first discussing the idea before starting to write code.
|
||||||
It would be unfortunate if you spend time working on a contribution that does not align with the ideals of the ddnet project.
|
It would be unfortunate if you spend time working on a contribution that does not align with the ideals of the DDNet project.
|
||||||
|
|
||||||
A non exhaustive list of things that usually get rejected would be:
|
A non-exhaustive list of things that usually get rejected:
|
||||||
- Extending the dummy with new gameplay affecting features.
|
- Extending dummy with new gameplay-affecting features.
|
||||||
https://github.com/ddnet/ddnet/pull/8275
|
https://github.com/ddnet/ddnet/pull/8275
|
||||||
https://github.com/ddnet/ddnet/pull/5443#issuecomment-1158437505
|
https://github.com/ddnet/ddnet/pull/5443#issuecomment-1158437505
|
||||||
- Breaking backwards compatibility in the network protocol or file formats such as skins and demos.
|
- Breaking backwards compatibility in the network protocol or file formats such as skins and demos.
|
||||||
- Breaking backwards compatibility in gameplay.
|
- Breaking backwards compatibility in gameplay:
|
||||||
+ Existing ranks should not be made impossible.
|
+ Existing ranks should not be made impossible.
|
||||||
+ Existing maps should not break.
|
+ Existing maps should not break.
|
||||||
+ New gameplay should not make runs easier on already completed maps.
|
+ New gameplay should not make runs easier on already completed maps.
|
||||||
|
|
||||||
## Code style
|
## Code style
|
||||||
|
|
||||||
There are a few style rules. Some of them are enforced by the github actions CI and some of them are manually checked by reviewers.
|
There are a few style rules. Some of them are enforced by CI and some of them are manually checked by reviewers.
|
||||||
If your github pipeline shows some errors please have a look at the logs and try to fix them.
|
If your github pipeline shows some errors please have a look at the logs and try to fix them.
|
||||||
|
|
||||||
Such fix commits should ideally be squashed into one big commit using ``git commit --amend`` or ``git rebase -i``.
|
Such fix commits should ideally be squashed into one big commit using ``git commit --amend`` or ``git rebase -i``.
|
||||||
|
@ -74,7 +74,7 @@ More examples can be found [here](https://github.com/ddnet/ddnet/pull/8288#issue
|
||||||
|
|
||||||
### Teeworlds interpretation of the hungarian notation
|
### Teeworlds interpretation of the hungarian notation
|
||||||
|
|
||||||
DDNet inherited the hungarian notation like prefixes from [teeworlds](https://www.teeworlds.com/?page=docs&wiki=nomenclature)
|
DDNet inherited the hungarian notation like prefixes from [Teeworlds](https://www.teeworlds.com/?page=docs&wiki=nomenclature)
|
||||||
|
|
||||||
`m_`
|
`m_`
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ class CFoo
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### The usage of `goto` is strictly forbidden
|
### The usage of `goto` is not encouraged
|
||||||
|
|
||||||
Do not use the `goto` keyword.
|
Do not use the `goto` keyword in new code, there are better control flow constructs in C++.
|
||||||
|
|
||||||
### Assignments in if statements should be avoided
|
### Assignments in if statements should be avoided
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ Unless the alternative code is more complex and harder to read.
|
||||||
|
|
||||||
### Methods with default arguments should be avoided
|
### Methods with default arguments should be avoided
|
||||||
|
|
||||||
Default arguments tend to break soon, if you have multiple you have to specify each even if you only want to change the last one.
|
Default arguments tend to break quickly, if you have multiple you have to specify each even if you only want to change the last one.
|
||||||
|
|
||||||
### Method overloading should be avoided
|
### Method overloading should be avoided
|
||||||
|
|
||||||
|
@ -198,7 +198,8 @@ class CFoo
|
||||||
### Modern C++ should be used instead of old C styled code
|
### Modern C++ should be used instead of old C styled code
|
||||||
|
|
||||||
DDNet balances in being portable (easy to compile on all common distributions) and using modern features.
|
DDNet balances in being portable (easy to compile on all common distributions) and using modern features.
|
||||||
So you are encouraged to use all modern C++ features as long as their age is older than the newest supported C++ version of ddnet.
|
So you are encouraged to use all modern C++ features as long as they are supported by the C++ version we use.
|
||||||
|
Still be aware that in game loop code you should avoid allocations, so static buffers on the stack can be preferable.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- Use `nullptr` instead of `0` or `NULL`.
|
- Use `nullptr` instead of `0` or `NULL`.
|
||||||
|
@ -228,4 +229,4 @@ src/game/foo_bar.cpp
|
||||||
|
|
||||||
## Commit messages
|
## Commit messages
|
||||||
|
|
||||||
There are no strict rules for commit messages. But it would be nicer to say "Add new feature xyz" instead of "added new feature xyz".
|
Describe the change your contribution is making for the player/user instead of talking about what you did in a technical sense. Your PR messages will ideally be in a format that can directly be used in the [change log](https://ddnet.org/downloads/).
|
||||||
|
|
Loading…
Reference in a new issue