Skip to content

Commit 6b32224

Browse files
committed
Fix review comments, add more infos
1 parent b1ed7d9 commit 6b32224

File tree

1 file changed

+50
-15
lines changed

1 file changed

+50
-15
lines changed

CONTRIBUTING.md

+50-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
# How to contribute as developer
1+
# How to contribute as a developer
22

3-
To make contributions, aka Pull Requests, fork and clone this repository.
3+
To contribute, fork and clone this repository.
44

5-
## Code Guidelines
5+
## Code guidelines
66

7-
### 1. Scope of code changes
7+
### Scope of code changes
88

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.
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 can be merged with **Rebase and Merge** if these commits are meant to be preserved on the main branch. Otherwise, the regular method of merging is **Squash and Merge**.
1010

11-
### 2. Style of code changes
11+
### Style of code changes
1212

1313
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.
1414

15-
### 3. Language style guide
15+
### Language style guide
1616

1717
*Work in progress. Needs a maintainer. Can be built upon existing Code guidelines, such as the "Google C++ Style Guide".*
1818

19+
### Precedence of code changes
1920

20-
## Change Documentation
21+
Changes to Zero Hour take precendence over Generals, if applicable. When the changed code is not shared by both titles, then the change needs to be created for Zero Hour first, and then recreated for Generals. The implementation of a change for both titles needs to be identical or as close as possible. Preferably the Generals replica of a change comes with the same Pull Request. The Generals replica can be created after the Zero Hour code review has finished.
22+
23+
24+
## Change documentation
2125

2226
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.
2327

@@ -40,9 +44,9 @@ Bad:
4044
> Fixes particle effect of MD
4145
4246

43-
### 3. Code Documentation
47+
### Code documentation
4448

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.
49+
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 file, class, function or block. It must be clear from the change description what has changed.
4650

4751
The expected comment format is
4852

@@ -71,8 +75,13 @@ Block comment sample
7175
memset(&os_info,0,sizeof(os_info));
7276
```
7377

78+
Optionally, the pull request number can be appended to the comment. This can only be done after the pull request has been created.
79+
80+
```
81+
// TheSuperHackers @bugfix JAJames 17/03/2025 Fix uninitialized memory access and add more Windows versions. (#123)
82+
```
7483

75-
### 4. Pull Request Documentation
84+
### Pull request documentation
7685

7786
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*`.
7887

@@ -86,23 +95,49 @@ Bad:
8695
Minimal changes for successful build.
8796
```
8897

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.
98+
Currently established commit title tags are
99+
100+
* [GEN]
101+
* [ZH]
102+
* [CORE]
103+
* [CMAKE]
104+
* [GITHUB]
105+
* [LINUX]
106+
107+
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 parentheses. 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.
90108

91109
The text body begins with links to related issue report(s) and/or Pull Request(s) if applicable.
92110

93-
To write a link, use the following format:
111+
To write a link use the following format:
94112

95113
```
114+
* Fixes #222
115+
* Closes #333
96116
* Relates to #555
97117
* Follow up for #666
98-
* Fixes #222
99118
```
100119

120+
Links are commonly used for
121+
122+
* closing a related issue report or task when this pull request is merged
123+
* closing another pull request when this pull request is merged
124+
101125
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).
102126

103127
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.
104128

105129

106-
### 5. Change Log Documentation
130+
### Pull request merging rules
131+
132+
Please be mindful when merging changes. There are pitfalls in regards to the commit title consistency.
133+
134+
When attempting to **Squash and Merge** a Pull Request that contains a single commit, then GitHub will default generate a commit title from that single commit. Typically this is undesired, when the new commit title is meant to be kept in sync with the Pull Request title rather than the Pull Request commit title. The generated commit title may need to be adjusted before merging the Pull Request.
135+
136+
When attempting to **Squash and Merge** a Pull Request that contains multiple commits, the GitHub will default generate a commit title from the Pull Request title. Additionally it will generate a commit description from the multiple commits that are part of the Pull Request. The generated commit description generally needs to be cleared before merging the Pull Request to keep the commit title clean.
137+
138+
When attempting to **Rebase and Merge** a Pull Request, then all commits will transfer with the same names to the main branch. Verify that all commit titles are properly crafted, with tags where applicable, trailing Pull Request numbers in parentheses and no unnecessary commit descriptions (texts below the commit title).
139+
140+
141+
### Change log documentation
107142

108143
*Work in progress.*

0 commit comments

Comments
 (0)