Skip to content

Commit 5d220f0

Browse files
committed
Clarify how to write a commit message and CHANGELOGs
1 parent a4d0c61 commit 5d220f0

File tree

2 files changed

+78
-28
lines changed

2 files changed

+78
-28
lines changed

contributing/code/conventions.rst

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ coding standards and conventions used in the core framework to make it more
77
consistent and predictable. You are encouraged to follow them in your own
88
code, but you don't need to.
99

10-
Method Names
11-
------------
10+
Naming a Method
11+
---------------
1212

1313
When an object has a "main" many relation with related "things"
1414
(objects, parameters, ...), the method names are normalized:
@@ -77,19 +77,63 @@ must be used instead (where ``XXX`` is the name of the related thing):
7777
``replaceXXX()``, on the other hand, cannot add new elements. If an unrecognized
7878
key is passed to ``replaceXXX()`` it must throw an exception.
7979

80+
Writing a CHANGELOG Entry
81+
-------------------------
82+
83+
When adding a new feature in a minor version or deprecating an existing
84+
behavior, an entry to the relevant CHANGELOG(s) should be added.
85+
86+
New features and deprecations must be described in a file named
87+
``CHANGELOG.md`` that should be at the root directory of the modified
88+
Component/Bridge/Bundle.
89+
90+
The file must be written with the Markdown syntax and follow the following
91+
conventions:
92+
93+
* The main title is always ``CHANGELOG``;
94+
95+
* Each entry must be added to a minor version section (like ``5.3``) as a list
96+
element;
97+
98+
* No third level sections are allowed;
99+
100+
* Messages should follow the commit message conventions: should be short,
101+
capitalize the line, do not end with a period, use an imperative verb to
102+
start the line;
103+
104+
* New entries must be added on top of the list.
105+
106+
Here is a complete example for reference:
107+
108+
.. code-block:: markdown
109+
110+
CHANGELOG
111+
=========
112+
113+
5.3
114+
---
115+
116+
* Add `MagicConfig` that allows configuring things
117+
118+
.. note::
119+
120+
The main ``CHANGELOG-*`` files at the ``symfony/symfony`` root directory
121+
are automatically generated when releases are prepared and should never be
122+
modified "manually".
123+
80124
.. _contributing-code-conventions-deprecations:
81125

82126
Deprecating Code
83127
----------------
84128

85-
From time to time, some classes and/or methods are deprecated in the
86-
framework; that happens when a feature implementation cannot be changed
87-
because of backward compatibility issues, but we still want to propose a
88-
"better" alternative. In that case, the old implementation can be **deprecated**.
129+
From time to time, some classes and/or methods are deprecated in the framework;
130+
that happens when a feature implementation cannot be changed because of
131+
backward compatibility issues, but we still want to propose a "better"
132+
alternative. In that case, the old implementation can be **deprecated**.
89133

90134
Deprecations must only be introduced on the next minor version of the impacted
91-
component (or bundle, or bridge, or contract).
92-
They can exceptionally be introduced on previous supported versions if they are critical.
135+
component (or bundle, or bridge, or contract). They can exceptionally be
136+
introduced on previous supported versions if they are critical.
93137

94138
A new class (or interface, or trait) cannot be introduced as deprecated, or
95139
contain deprecated methods.
@@ -144,26 +188,28 @@ after the use declarations, like in this example from
144188

145189
The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component::
146190

147-
4.4.0
148-
-----
191+
4.4
192+
---
149193

150-
* Deprecated the `Deprecated` class, use `Replacement` instead.
194+
* Deprecate the `Deprecated` class, use `Replacement` instead
151195

152196
It must also be added to the ``UPGRADE.md`` file of the targeted minor version
153197
(``UPGRADE-4.4.md`` in our example)::
154198

155199
DependencyInjection
156200
-------------------
157201

158-
* Deprecated the `Deprecated` class, use `Replacement` instead.
202+
* Deprecate the `Deprecated` class, use `Replacement` instead
159203

160204
Finally, its consequences must be added to the ``UPGRADE.md`` file of the next major version
161-
(``UPGRADE-5.0.md`` in our example)::
205+
(``UPGRADE-5.0.md`` in our example):
206+
207+
.. code-block:: markdown
162208
163209
DependencyInjection
164210
-------------------
165211
166-
* Removed the `Deprecated` class, use `Replacement` instead.
212+
* Remove the `Deprecated` class, use `Replacement` instead
167213
168214
All these tasks are mandatory and must be done in the same pull request.
169215

@@ -174,12 +220,14 @@ Removing deprecated code can only be done once every 2 years, on the next major
174220
impacted component (``master`` branch).
175221

176222
When removing deprecated code, the consequences of the deprecation must be added to the ``CHANGELOG.md`` file
177-
of the impacted component::
223+
of the impacted component:
224+
225+
.. code-block:: markdown
178226
179-
5.0.0
180-
-----
227+
5.0
228+
---
181229
182-
* Removed the `Deprecated` class, use `Replacement` instead.
230+
* Remove the `Deprecated` class, use `Replacement` instead
183231
184232
This task is mandatory and must be done in the same pull request.
185233

contributing/code/pull_requests.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,18 @@ in mind the following:
224224
* Never fix coding standards in some existing code as it makes the code review
225225
more difficult;
226226

227-
* Write good commit messages (see the tip below).
227+
* Write good commit messages: Start by a short subject line (the first line),
228+
followed by a blank line and a more detailed description.
229+
230+
The subject line should start with the Component/Bridge/Bundle you are
231+
working on in square brackets (``[DependencyInjection]``,
232+
``[FrameworkBundle]``, ...).
233+
234+
Then, capitalize the sentence, do not end with a period, and use an
235+
imperative verb to start.
236+
237+
Here is a full example of a subject line: ``[MagicBundle] Add `MagicConfig`
238+
that allows configuring things``.
228239

229240
.. tip::
230241

@@ -235,15 +246,6 @@ in mind the following:
235246
A status is posted below the pull request description with a summary
236247
of any problems it detects or any `Travis-CI`_ build failures.
237248

238-
.. tip::
239-
240-
A good commit message is composed of a summary (the first line),
241-
optionally followed by a blank line and a more detailed description. The
242-
summary should start with the Component you are working on in square
243-
brackets (``[DependencyInjection]``, ``[FrameworkBundle]``, ...). Use a
244-
verb (``fixed ...``, ``added ...``, ...) to start the summary and don't
245-
add a period at the end.
246-
247249
.. _prepare-your-patch-for-submission:
248250

249251
Prepare your Pull Request for Submission

0 commit comments

Comments
 (0)