-
Notifications
You must be signed in to change notification settings - Fork 1
Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
- All features or bug fixes must be tested by one or more specs (unit-tests).
- All public API methods must be documented.
- Development must happen on local systems.
- Development must use Git as the version control system
- Changes must be made in non protected branches following our Branching Rules
- Any changes to local branchs should be pushed to remote on a regular (nightly) basis.
- Unit tests should be ran locally as needed, and through a CICD systems(CircleCI, AWS CodeBuild/CodeDeploy) for every commit pushed to remote.
- All commits must follow our commit message format
This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].
We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.
Each commit message consists of a header, a body, and a footer.
<header>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
The header
is mandatory and must conform to the Commit Message Header format.
The body
is optional. When the body is present it must be at least 20 characters long and must conform to the Commit Message Body format.
The footer
is optional. The Commit Message Footer format describes what the footer is used for and the structure it must have.
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: matchmaker|gameserver
│
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
The <type>
, (<scope>)
, and <summary>
fields are mandatory.
Must be one of the following:
- build: Changes that affect the build system or external dependencies (example scopes: nuget)
- ci: Changes to our CI configuration files and scripts (examples: CircleCi)
- docs: Documentation only changes
- feat: A new feature
- fix: A bug fix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- test: Adding missing tests or correcting existing tests
The scope should be the name of the service affected.
Scopes are subject to change to specific code based scopes.
- matchmaker
- gameserver
Use the summary field to provide a succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
Explain the motivation for the change in the commit message body. This commit message should explain why you are making the change. You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.
The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, and other PRs that this commit closes or is related to. For example:
BREAKING CHANGE: <breaking change summary>
<BLANK LINE>
<breaking change description + migration instructions>
<BLANK LINE>
<BLANK LINE>
Fixes #<issue number>
or
DEPRECATED: <what is deprecated>
<BLANK LINE>
<deprecation description + recommended update path>
<BLANK LINE>
<BLANK LINE>
Closes #<pr number>
Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
Similarly, a Deprecation section should start with "DEPRECATED: " followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
If the commit reverts a previous commit, it should begin with revert:
, followed by the header of the reverted commit.
The content of the commit message body should contain:
- information about the SHA of the commit being reverted in the following format:
This reverts commit <SHA>
, - a clear description of the reason for reverting the commit message.
%%{init: {'theme': 'dark', 'gitGraph': {'mainBranchName':'main', 'mainBranchOrder': 1, 'rotateCommitLabel': true}}}%%
gitGraph
commit
commit
branch AP-0001 order: 2
commit id:"feat(AP-0001): change spelling"
commit
commit
checkout main
merge AP-0001
commit
branch REVERT-AP-0001 order: 3
commit type: reverse id: "remove merge commit"
checkout main
merge REVERT-AP-0001
commit
You can revert individual commits with:
git revert <commit_hash>
This will create a new commit which reverts the changes of the commit you specified. Note that it only reverts that specific commit, and not commits that come after that. If you want to revert a range of commits, you can do it like this:
git revert <oldest_commit_hash>..<latest_commit_hash>
It reverts all the commits after <oldest_commit_hash>
up to and including <latest_commit_hash>
. On some versions of git it also reverts the <oldest_commit_hash>
, so double check if that commit gets reverted or not. You can always drop the latest revert commit (which reverts the oldest commit) with git reset --hard HEAD~
.
To know the hash of the commit(s) you can use git log.
Look at the git-revert man page for more information about the git revert command. Also, look at this answer for more information about reverting commits. 1
You can also use the GitHub GUI to perform the same set of actions following: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/reverting-a-pull-request#reverting-a-pull-request