Skip to content

Commit 3f19ed6

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Clarify how to write a commit message and CHANGELOGs
2 parents 7cb4c17 + 5f2ce0e commit 3f19ed6

File tree

2 files changed

+80
-28
lines changed

2 files changed

+80
-28
lines changed

contributing/code/conventions.rst

+68-18
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ 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+
.. _method-names:
11+
12+
Naming a Method
13+
---------------
1214

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

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

82128
Deprecating Code
83129
----------------
84130

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**.
131+
From time to time, some classes and/or methods are deprecated in the framework;
132+
that happens when a feature implementation cannot be changed because of
133+
backward compatibility issues, but we still want to propose a "better"
134+
alternative. In that case, the old implementation can be **deprecated**.
89135

90136
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.
137+
component (or bundle, or bridge, or contract). They can exceptionally be
138+
introduced on previous supported versions if they are critical.
93139

94140
A new class (or interface, or trait) cannot be introduced as deprecated, or
95141
contain deprecated methods.
@@ -139,26 +185,28 @@ after the use declarations, like in this example from `ServiceRouterLoader`_::
139185

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

142-
4.4.0
143-
-----
188+
4.4
189+
---
144190

145-
* Deprecated the `Deprecated` class, use `Replacement` instead.
191+
* Deprecate the `Deprecated` class, use `Replacement` instead
146192

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

150196
DependencyInjection
151197
-------------------
152198

153-
* Deprecated the `Deprecated` class, use `Replacement` instead.
199+
* Deprecate the `Deprecated` class, use `Replacement` instead
154200

155201
Finally, its consequences must be added to the ``UPGRADE.md`` file of the next major version
156-
(``UPGRADE-5.0.md`` in our example)::
202+
(``UPGRADE-5.0.md`` in our example):
203+
204+
.. code-block:: markdown
157205
158206
DependencyInjection
159207
-------------------
160208
161-
* Removed the `Deprecated` class, use `Replacement` instead.
209+
* Remove the `Deprecated` class, use `Replacement` instead
162210
163211
All these tasks are mandatory and must be done in the same pull request.
164212

@@ -169,11 +217,13 @@ Removing deprecated code can only be done once every 2 years, on the next major
169217
impacted component (``master`` branch).
170218

171219
When removing deprecated code, the consequences of the deprecation must be added to the ``CHANGELOG.md`` file
172-
of the impacted component::
220+
of the impacted component:
221+
222+
.. code-block:: markdown
173223
174-
5.0.0
175-
-----
224+
5.0
225+
---
176226
177-
* Removed the `Deprecated` class, use `Replacement` instead.
227+
* Remove the `Deprecated` class, use `Replacement` instead
178228
179229
This task is mandatory and must be done in the same pull request.

contributing/code/pull_requests.rst

+12-10
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 or 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)