Skip to content

Commit 7080f12

Browse files
make commit message rules user friendlier (#1043)
1 parent a9b3e88 commit 7080f12

File tree

2 files changed

+27
-55
lines changed

2 files changed

+27
-55
lines changed

.gitlint

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,25 @@
77
# T5: title-must-not-contain-word (disabled)
88
# T6: title-leading-whitespace
99
# T7: title-match-regex
10-
# B1: body-max-line-length (disabled)
10+
# B1: body-max-line-length (disabled: allows longer lines when needed, as this is just annoying post writing)
1111
# B2: body-trailing-whitespace
1212
# B3: body-hard-tab
1313
# B4: body-first-line-empty
1414
# B5: body-min-length (disabled)
15-
# B6: body-is-missing
15+
# B6: body-is-missing (disabled: allow trivial commits without a body)
1616
# B7: body-changed-file-mention (disabled)
1717
#
1818
# See http://jorisroovers.github.io/gitlint/rules/ for a full description of the rules.
1919
# See https://eclipse-score.github.io/score/main/contribute/general/git.html for our commit message guidelines.
2020

2121
# Ignore some default rules and enable regex style searching
2222
[general]
23-
ignore=T3,T5,B1,B5,B7
23+
ignore=T3,T5,B1,B5,B6,B7
2424
regex-style-search=true
2525

2626
# Maximum length of the title
2727
[title-max-length]
2828
line-length=72
2929

30-
[title-match-regex]
31-
regex=^[a-z_-]+: .+$
32-
3330
# First line of the commit message body must be empty. (second line of the commit message)
3431
[body-first-line-empty]
35-
36-
#Ignores the title if it starts with Revert or Merge
37-
[ignore-by-title]
38-
regex=(^Revert |^Merge )

docs/contribute/general/git.rst

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ the quality of the commits and their respective commit messages.
3434
Git Configuration
3535
******************
3636

37-
Since name and e-mail address are part of the commit (and thus be part
38-
of the commit history) they shall be specified via the .gitconfig file.
39-
So this file must at least include the following lines:
37+
Authors name and e-mail address are part of the commit (and thus be part of the commit history).
38+
They must match the name and e-mail used for eclipse registration. They can be specified via the
39+
.gitconfig file:
4040

4141
.. code-block::
4242
@@ -45,11 +45,10 @@ So this file must at least include the following lines:
4545
name = Max Mustermann
4646
4747
***************
48-
Commit History
48+
Merging PRs
4949
***************
5050

51-
Before merging a PR all commits shall be squashed into few (desired only
52-
one) logical commits. This is done following the rules below.
51+
When merging a PR via the GitHub user interface:
5352

5453
Use ``Squash & Merge`` in case:
5554

@@ -62,11 +61,8 @@ Use ``Squash & Merge`` in case:
6261

6362
Use ``Rebase & Merge`` or ``Merge Commit`` in case:
6463

65-
#. the commits address different topics
66-
67-
- Sort by topics and combine each topic to a single commit.
68-
- It is advised that a PR addresses a single/atomic topic.
69-
- Preferred way are separated PRs for separate topics.
64+
#. the commits address different topics. Note however that it is preferred that a PR addresses a
65+
single/atomic topic.
7066

7167
**OR**
7268
#. the commits have different authors
@@ -114,38 +110,27 @@ Summary
114110
115111
<prefix_name>: Summary
116112
117-
The Subject shall describe what was changed in a single line max 72
118-
characters long. It shall include a prefix for the module, component or
119-
feature which was changed e.g. "doc:" or "bazel:" It shall start with a
120-
capital letter and should not be ended by a trailing period in the
121-
subject line.
113+
The Subject shall describe what was changed in a single line max 72 characters long. It shall not
114+
start or end with whitespace. It shall not end with a period.
122115

123116
Good and bad examples for a subject are:
124117

125-
- **mw: Show colorful output** not Add file
126-
- **bazel: Test Requirement SWS_CM_00001** not Add test
127-
- **osal: Split responsibilities of job handling and execution** not Refactor code
118+
- **Show colorful output** not Add file
119+
- **Test Requirement SWS_CM_00001** not Add test
120+
- **Split responsibilities of job handling and execution** not Refactor code
128121

129122
Description
130123
===========
131124

132-
The description must contain a brief summary of the content of the
133-
commit and why this is necessary. Furthermore it must be consistent and
134-
logically complete.
135-
136-
If feasible, the commit message body should be extended with quoted
137-
material such as compiler warnings, debugger stack traces or measurement
138-
data for performance optimizations.
139-
140-
The description may mention issues and link to them. A detailed description
141-
of linking commits to issues is available on `GitHub
142-
<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue>`__.
143-
Be aware that keywords like (close | fix | resolve) will also close the
144-
referenced issue if the pull request is merged.
125+
The optional description can be used to provide a brief summary of the content of the
126+
commit and why this is necessary.
145127

146128
Git commits are not required to mention issues. It is sufficient if the PR
147129
links to any relevant issues.
148130

131+
The description may mention issues and link to them. Note that when squashing as described above, a
132+
link to the PR is automatically added.
133+
149134
Footer
150135
======
151136

@@ -156,31 +141,25 @@ in the following format:
156141
157142
Also-by: Some Bodyelse <[email protected]>
158143
159-
An additional check is implemented to suppress false positives: if a
160-
commit message has revert/merge in the first line, the linting rules
161-
will not be applied to it. Thereby headaches when performing reverts or
162-
merges are reduced.
163-
164144
Layout Summary
165145
==============
166146

167147
In short the commit message shall consist of:
168148

169149
- Summary
170-
- Empty line
171-
- Description
172-
- Empty line
173-
- Footer
150+
- Empty line (required in case description is present)
151+
- Description (optional)
152+
- Empty line (required if footer is present)
153+
- Footer (optional)
174154

175155
Example
176156
=======
177157
.. code-block::
178158
179-
component: Short one line summary of change
159+
Short one line summary of change
180160
181-
More detailed explanatory text, mandatory. Wrap it to about 72
182-
characters or less. The first line is treated as the subject and the
183-
rest of the text as the body. The blank line separating the summary from
161+
More detailed explanatory text, optional. Wrap it to about 72
162+
characters or less. The blank line separating the summary from
184163
the body is critical (unless you omit the body entirely);
185164
186165
- Bullet points are okay, too

0 commit comments

Comments
 (0)