deen's tweaks in CONTRIBUTING.md

Co-authored-by: Dennis Felsing <dennis@felsing.org>
This commit is contained in:
Chiller Dragon 2024-10-06 17:59:21 +08:00 committed by ChillerDragon
parent 77cee822a7
commit 0aa6cfc307

View file

@ -1,23 +1,23 @@
# Contributing code to ddnet
# Contributing code to DDNet
## General
Please open issues 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.
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.
A non exhaustive list of things that usually get rejected would be:
- Extending the dummy with new gameplay affecting features.
A non-exhaustive list of things that usually get rejected:
- Extending dummy with new gameplay-affecting features.
https://github.com/ddnet/ddnet/pull/8275
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 gameplay.
- Breaking backwards compatibility in gameplay:
+ Existing ranks should not be made impossible.
+ Existing maps should not break.
+ New gameplay should not make runs easier on already completed maps.
## 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.
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
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_`
@ -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
@ -151,7 +151,7 @@ Unless the alternative code is more complex and harder to read.
### 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
@ -198,7 +198,8 @@ class CFoo
### 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.
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:
- Use `nullptr` instead of `0` or `NULL`.
@ -228,4 +229,4 @@ src/game/foo_bar.cpp
## 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/).