Skip to content

Commit 09b30d5

Browse files
committed
minor #14830 Clarify how to write a commit message and CHANGELOGs (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- Clarify how to write a commit message and CHANGELOGs <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 8ecd162 Clarify how to write a commit message and CHANGELOGs
2 parents 33e7be5 + 8ecd162 commit 09b30d5

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.
@@ -144,26 +190,28 @@ after the use declarations, like in this example from
144190

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

147-
4.4.0
148-
-----
193+
4.4
194+
---
149195

150-
* Deprecated the `Deprecated` class, use `Replacement` instead.
196+
* Deprecate the `Deprecated` class, use `Replacement` instead
151197

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

155201
DependencyInjection
156202
-------------------
157203

158-
* Deprecated the `Deprecated` class, use `Replacement` instead.
204+
* Deprecate the `Deprecated` class, use `Replacement` instead
159205

160206
Finally, its consequences must be added to the ``UPGRADE.md`` file of the next major version
161-
(``UPGRADE-5.0.md`` in our example)::
207+
(``UPGRADE-5.0.md`` in our example):
208+
209+
.. code-block:: markdown
162210
163211
DependencyInjection
164212
-------------------
165213
166-
* Removed the `Deprecated` class, use `Replacement` instead.
214+
* Remove the `Deprecated` class, use `Replacement` instead
167215
168216
All these tasks are mandatory and must be done in the same pull request.
169217

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

176224
When removing deprecated code, the consequences of the deprecation must be added to the ``CHANGELOG.md`` file
177-
of the impacted component::
225+
of the impacted component:
226+
227+
.. code-block:: markdown
178228
179-
5.0.0
180-
-----
229+
5.0
230+
---
181231
182-
* Removed the `Deprecated` class, use `Replacement` instead.
232+
* Remove the `Deprecated` class, use `Replacement` instead
183233
184234
This task is mandatory and must be done in the same pull request.
185235

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)