|
1 |
| -# How to contribute as developer |
| 1 | +# How to contribute as a developer |
2 | 2 |
|
3 |
| -To make contributions, aka Pull Requests, fork and clone this repository. |
| 3 | +To contribute, fork and clone this repository. |
4 | 4 |
|
5 |
| -## Code Guidelines |
| 5 | +## Code guidelines |
6 | 6 |
|
7 |
| -### 1. Scope of code changes |
| 7 | +### Scope of code changes |
8 | 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. |
| 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**. |
10 | 10 |
|
11 |
| -### 2. Style of code changes |
| 11 | +### Style of code changes |
12 | 12 |
|
13 | 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 | 14 |
|
15 |
| -### 3. Language style guide |
| 15 | +### Language style guide |
16 | 16 |
|
17 | 17 | *Work in progress. Needs a maintainer. Can be built upon existing Code guidelines, such as the "Google C++ Style Guide".*
|
18 | 18 |
|
| 19 | +### Precedence of code changes |
19 | 20 |
|
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 |
21 | 25 |
|
22 | 26 | 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 | 27 |
|
|
40 | 44 | > Fixes particle effect of MD
|
41 | 45 |
|
42 | 46 |
|
43 |
| -### 3. Code Documentation |
| 47 | +### Code documentation |
44 | 48 |
|
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. |
46 | 50 |
|
47 | 51 | The expected comment format is
|
48 | 52 |
|
@@ -71,8 +75,13 @@ Block comment sample
|
71 | 75 | memset(&os_info,0,sizeof(os_info));
|
72 | 76 | ```
|
73 | 77 |
|
| 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 | +``` |
74 | 83 |
|
75 |
| -### 4. Pull Request Documentation |
| 84 | +### Pull request documentation |
76 | 85 |
|
77 | 86 | 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 | 87 |
|
|
86 | 95 | Minimal changes for successful build.
|
87 | 96 | ```
|
88 | 97 |
|
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. |
90 | 108 |
|
91 | 109 | The text body begins with links to related issue report(s) and/or Pull Request(s) if applicable.
|
92 | 110 |
|
93 |
| -To write a link, use the following format: |
| 111 | +To write a link use the following format: |
94 | 112 |
|
95 | 113 | ```
|
| 114 | +* Fixes #222 |
| 115 | +* Closes #333 |
96 | 116 | * Relates to #555
|
97 | 117 | * Follow up for #666
|
98 |
| -* Fixes #222 |
99 | 118 | ```
|
100 | 119 |
|
| 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 | + |
101 | 125 | 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 | 126 |
|
103 | 127 | 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 | 128 |
|
105 | 129 |
|
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 |
107 | 142 |
|
108 | 143 | *Work in progress.*
|
0 commit comments