Skip to content

Commit 8086fdf

Browse files
committed
Update CONTRIBUTING.md
Add commit message style guidelines to CONTRIBUTING.md Relates-to: OLPEDGE-302 Signed-off-by: Kateryna Osadchenko <[email protected]>
1 parent f1f3c6b commit 8086fdf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# HERE OLP SDK for C++ Contributor Guide
22

3+
### Contributing to HERE OLP SDK for C++
4+
5+
First off, thanks for taking the time to contribute! The team behind the [HERE OLP SDK for C++](https://github.com/heremaps/here-olp-sdk-cpp) gratefully accepts contributions via [pull requests](https://help.github.com/articles/about-pull-requests/) filed against the [GitHub project](https://github.com/heremaps/here-olp-sdk-cpp/pulls). As part of filing a pull request we ask you to sign off the [Developer Certificate of Origin](https://developercertificate.org/) (DCO).
6+
37
## Development
48

59
### Code Style
@@ -102,6 +106,26 @@ If you need to format all `.cpp` and `.h` files in a directory recursively, you
102106
find foo/bar/ -iname *.h -o -iname *.cpp | xargs clang-format -i --style=file
103107
```
104108

109+
### Style Guidelines for Commit Messages
110+
111+
We strive to maintain a high software quality standard and strongly encourage contributions to keep up the following guidelines.
112+
In general, we share the view on how a commit message should be written with the [the Git project itself](https://github.com/git/git/blob/master/Documentation/SubmittingPatches).
113+
114+
- [Make separate commits for logically separate changes.](https://github.com/git/git/blob/e6932248fcb41fb94a0be484050881e03c7eb298/Documentation/SubmittingPatches#L43) For example, simple formatting changes that do not affect software behavior usually do not belong in the same commit as changes to program logic.
115+
- [Describe your changes well.](https://github.com/git/git/blob/e6932248fcb41fb94a0be484050881e03c7eb298/Documentation/SubmittingPatches#L101) Do not just repeat in prose what is "obvious" from the code, but provide a rationale explaining why you believe your change is necessary.
116+
- [Describe your changes in the imperative mood and present tense.](https://github.com/git/git/blob/e6932248fcb41fb94a0be484050881e03c7eb298/Documentation/SubmittingPatches#L133) Instead of writing "Fixes an issue with encoding" prefer "Fix an encoding issue". Think about it like the commit only does something if it is applied. Such approach usually results in more concise commit messages.
117+
- [We are picky about whitespaces.](https://github.com/git/git/blob/e6932248fcb41fb94a0be484050881e03c7eb298/Documentation/SubmittingPatches#L95) Trailing whitespace and duplicate blank lines are simply an annoyance, and most Git tools flag them red in the diff anyway. We generally use four spaces for indentation in TypeScript code, and two spaces for indentation in JSON / YAML files.
118+
119+
- Limit the first line to 72 characters or less.
120+
- If you ever wondered how a nearly "perfect" commit message looks like, have a look at one of [Jeff King's commits](https://github.com/git/git/commits?author=peff) in the Git project for references and ideas.
121+
- When you address a review comments in a pull request, please fix the issue in the commit where it appears, not in a new commit on top of the pull request's history. While this requires force-pushing of the new iteration of you pull request's branch, it has several advantages:
122+
- Reviewers that go through (larger) pull requests commit by commit are always up-to-date with latest fixes, instead of coming across a commit that addresses one of possibly also their remarks only at the end.
123+
- It maintains a cleaner history without distracting commits like "Address review comments".
124+
- As a result, tools like [git-bisect](https://git-scm.com/docs/git-bisect) can operate in a more meaningful way.
125+
- Fixing up commits allows for making fixes to commit messages, which is not possible by only adding new commits.
126+
- If you are unfamiliar with fixing up existing commits, please read about [rewriting history](https://git-scm.com/book/id/v2/Git-Tools-Rewriting-History) and git rebase --interactive in particular.
127+
- To resolve conflicts, rebase pull request branches onto their target branch instead of merging the target branch into the pull request branch — such approach results in a cleaner history without "criss-cross" merges.
128+
105129
### Design Guidelines
106130

107131
* Follow the **SOLID** design principles:

0 commit comments

Comments
 (0)