Skip to content

Commit 071f464

Browse files
committed
Add CONTRIBUTE document
1 parent 7f4c703 commit 071f464

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

CONTRIBUTE.md

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# How to contribute as developer
2+
3+
To make contributions, aka Pull Requests, fork and clone this repository.
4+
5+
## Code Guidelines
6+
7+
### 1. Scope of code changes
8+
9+
Code edits only touch the lines of code that serve the intended goal of the change. Big refactors should not be combined with logical changes, because these can become very difficult to review. If a change requires a refactor, create a commit for the refactor before (or after) creating a commit for the change. A Pull Request can contain multiple commits and must be merged with **Merge with Rebase** accordingly.
10+
11+
### 2. Style of code changes
12+
13+
Code edits should fit the nearby code in ways that the code style reads consistent, unless the original code style is bad. The original game code uses c++98, or a deviation thereof, and is simple to read. Prefer to not use new fancy language features where not absolutely necessary to get a particular change done.
14+
15+
### 3. Language style guide
16+
17+
*Work in progress. Needs a maintainer. Can be built upon existing Code guidelines, such as the "Google C++ Style Guide".*
18+
19+
20+
## Change Documentation
21+
22+
User facing changes need to be documented in code, Pull Requests and change logs. All documentation ideally is written in the present tense, and not the past.
23+
24+
Good:
25+
26+
> Fixes particle effect of USA Missile Defender
27+
28+
Bad:
29+
30+
> Fixed particle effect of USA Missile Defender
31+
32+
When a text refers to a faction unit, structure, upgrade or similar, then the unit should be worded without any abbrevations and should be prefixed with the faction name. Valid faction names are USA, China, GLA, Boss, Civilian. Subfaction names can be appended too, for example GLA Stealth.
33+
34+
Good:
35+
36+
> Fixes particle effect of USA Missile Defender
37+
38+
Bad:
39+
40+
> Fixes particle effect of MD
41+
42+
43+
### 3. Code Documentation
44+
45+
User facing changes need to be accompanied by comment(s) where the change is made. Maintenance related changes, such as compilation fixes, typically do not need commenting, unless the next reader can benefit from a special explanation. The comment can be put at the begin of the changed class, function or block. It must be clear from the change description what has changed.
46+
47+
The expected comment format is
48+
49+
```
50+
// TheSuperHackers @keyword author DD/MM/YYYY A meaningful description for this change.
51+
```
52+
53+
The `TheSuperHackers` word and `@keyword` are mandatory. `author` and date can be omitted when preferred.
54+
55+
| Keyword | Use-case |
56+
|------------------|-------------------------------------------------------------|
57+
| @bugfix | Fixes a bug |
58+
| @fix | Fixes something, but is not a user facing bug |
59+
| @compile | Addresses a compile warning or error |
60+
| @feature | Adds something new |
61+
| @performance | Improves performance |
62+
| @refactor | Moves or rewrites code, but does not change the behaviour |
63+
| @tweak | Changes values or settings |
64+
| @info | Writes useful information for the next reader |
65+
| @todo | Adds a note for something left to do if really necessary |
66+
67+
Block comment sample
68+
69+
```
70+
// TheSuperHackers @bugfix JAJames 17/03/2025 Fix uninitialized memory access and add more Windows versions.
71+
memset(&os_info,0,sizeof(os_info));
72+
```
73+
74+
75+
### 4. Pull Request Documentation
76+
77+
The title of a new Pull Request, and/or commit(s) within, begin with a **[GEN]** and/or **[ZH]** tag, depending on the game(s) it targets. If a change does not target a game, then a tag is not necessary. Furthermore, the title consists of a concise and descriptive sentence about the change and/or commit, beginning with an uppercase letter and ending without a dot. The title ideally begins with a word that describes the action that the change takes, for example `Fix *this*`, `Change *that*`, `Add *those*`, `Refactor *thing*`.
78+
79+
Good:
80+
```
81+
[GEN][ZH] Fix uninitialized memory access in Get_OS_Info
82+
```
83+
84+
Bad:
85+
```
86+
Minimal changes for successful build.
87+
```
88+
89+
If the Pull Request is meant to be merged with rebase, then a note for **Merge with Rebase** should be added to the top of the text body, to help identify the correct merge action when it is ready for merge. All commits of the Pull Request need to be properly named and need the number of the Pull Request added as a suffix in parantheses. Example: **(#333)**. All commits need to be able to compile on their own without dependencies in newer commits of the same Pull Request. Prefer to create changes for **Squash and Merge**, as this will simplify things.
90+
91+
The text body begins with links to related issue report(s) and/or Pull Request(s) if applicable.
92+
93+
To write a link, use the following format:
94+
95+
```
96+
* Relates to #555
97+
* Follow up for #666
98+
* Fixes #222
99+
```
100+
101+
Some keywords are interpreted by GitHub. Read about it [here](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
102+
103+
The text body continues with a description of the change in appropriate detail. This serves to educate reviewers and visitors to get a good understanding of the change without the need to study and understand the associated changed files. If the change is controversial or affects gameplay in a considerable way, then a rationale text needs to be appended. The rationale explains why the given change makes sense.
104+
105+
106+
### 5. Change Log Documentation
107+
108+
*Work in progress.*

0 commit comments

Comments
 (0)