@@ -35,14 +35,17 @@ Commitizen
35
35
About
36
36
==========
37
37
38
- Interactive tool to commit based on established rules (like conventional commits) .
38
+ Commitizen is a tool designed for teams .
39
39
40
- It comes with some defaults commit styles,
41
- like conventional commits and jira and it's easily extendable .
40
+ Its main purpose is to define a standard way of commiting rules
41
+ and communicating it (using the cli provided by commitizen) .
42
42
43
- It's useful for teams, because it is possible to standardize the commiting style.
43
+ The reasoning behind it is that is easier to read, and enforces writing
44
+ descriptive commits.
44
45
45
- Also includes an automatic version bump system based on semver.
46
+ Besides that, having a convetion on your commits, makes it possible to
47
+ parse them and use them for something else, like generating automatically
48
+ the version or a changelog.
46
49
47
50
48
51
Installation
@@ -66,11 +69,10 @@ Installation
66
69
Features
67
70
========
68
71
69
- - Prompt your commit rules to the user
70
- - Display information about your commit rules (schema, example, info)
71
- - Auto **bump ** version based on semver using your rules (currently there is only support for conventionalcommits)
72
- - Future: New documentation
73
- - Future: Autochangelog
72
+ - Command line utility to create commits with your rules. Defaults: `Conventional commits <https://www.conventionalcommits.org >`_
73
+ - Display information about your commit rules (commands: schema, example, info)
74
+ - Bump version automatically using semantic verisoning based on the commits. `Read More <./docs/bump.md >`_
75
+ - Generate a changelog using "Keep a changelog" (Planned feature)
74
76
75
77
76
78
Commit rules
@@ -84,7 +86,6 @@ This is an example of how the git messages history would look like:
84
86
85
87
::
86
88
87
- BREAKING CHANGE: command send has been removed
88
89
fix: minor typos in code
89
90
feat: new command update
90
91
docs: improved commitizens tab in readme
@@ -95,6 +96,12 @@ This is an example of how the git messages history would look like:
95
96
docs(README): added about, installation, creating, etc
96
97
feat(config): new loads from ~/.cz and working project .cz .cz.cfg and setup.cfg
97
98
99
+ And then using ``cz bump `` you can change the version of your project
100
+
101
+ ``feat `` to ``MINOR ``
102
+ ``fix `` to ``PATCH ``
103
+
104
+
98
105
Commitizens
99
106
===========
100
107
@@ -155,142 +162,6 @@ Usage
155
162
schema show commit schema
156
163
bump bump semantic version based on the git log
157
164
158
-
159
- Configuration
160
- ==============
161
-
162
- **New! **: Support for ``pyproject.toml ``
163
-
164
- In your ``pyproject.toml `` you can add an entry like this:
165
-
166
- ::
167
-
168
- [tool.commitizen]
169
- name = cz_conventional_commits
170
- version = "0.1.0"
171
- files = [
172
- "src/__version__.py",
173
- "pyproject.toml"
174
- ]
175
-
176
-
177
- Also, you can create in your project folder a file called
178
- :code: `.cz `, :code: `.cz.cfg ` or in your :code: `setup.cfg `
179
- or if you want to configure the global default in your user's home
180
- folder a :code: `.cz ` file with the following information:
181
-
182
- ::
183
-
184
- [commitizen]
185
- name = cz_conventional_commits
186
- version = 0.1.0
187
- files = [
188
- "src/__version__.py",
189
- "pyproject.toml"
190
- ]
191
-
192
- The extra tab at the end (``] ``) is required.
193
-
194
- Creating a commiter
195
- ========================
196
-
197
- Create a file starting with :code: `cz_ ` for example :code: `cz_jira.py `.
198
- This prefix is used to detect the plugin. Same method `flask uses <http://flask.pocoo.org/docs/0.12/extensiondev/ >`_
199
-
200
- Inherit from :code: `BaseCommitizen ` and you must define :code: `questions `
201
- and :code: `message `. The others are optionals.
202
-
203
-
204
- .. code-block :: python
205
-
206
- from commitizen import BaseCommitizen
207
-
208
- class JiraCz (BaseCommitizen ):
209
-
210
- def questions (self ):
211
- """ Questions regarding the commit message.
212
-
213
- :rtype: list
214
- """
215
- questions = [
216
- {
217
- ' type' : ' input' ,
218
- ' name' : ' title' ,
219
- ' message' : ' Commit title'
220
- },
221
- {
222
- ' type' : ' input' ,
223
- ' name' : ' issue' ,
224
- ' message' : ' Jira Issue number:'
225
- },
226
- ]
227
- return questions
228
-
229
- def message (self , answers ):
230
- """ Generate the message with the given answers.
231
-
232
- :type answers: dict
233
- :rtype: string
234
- """
235
- return ' {0} (#{1} )' .format(answers[' title' ], answers[' issue' ])
236
-
237
- def example (self ):
238
- """ Provide an example to help understand the style (OPTIONAL)
239
- Used by cz example.
240
-
241
- :rtype: string
242
- """
243
- return ' Problem with user (#321)'
244
-
245
- def schema (self ):
246
- """ Show the schema used (OPTIONAL)
247
-
248
- :rtype: string
249
- """
250
- return ' <title> (<issue>)'
251
-
252
- def info (self ):
253
- """ Explanation of the commit rules. (OPTIONAL)
254
- :rtype: string
255
- """
256
- return ' We use this because is useful'
257
-
258
-
259
- discover_this = JiraCz # used by the plugin system
260
-
261
-
262
- The next file required is :code: `setup.py ` modified from flask version
263
-
264
- .. code-block :: python
265
-
266
- from distutils.core import setup
267
-
268
- setup(
269
- name = ' JiraCommitizen' ,
270
- version = ' 0.1.0' ,
271
- py_modules = [' cz_jira' ],
272
- license = ' MIT' ,
273
- long_description = ' this is a long description' ,
274
- install_requires = [' commitizen' ]
275
- )
276
-
277
- So at the end we would have
278
-
279
- ::
280
-
281
- .
282
- ├── cz_jira.py
283
- └── setup.py
284
-
285
- And that's it, you can install it without uploading to pypi by simply doing
286
- :code: `pip install . ` If you feel like it should be part of the repo, create a
287
- PR.
288
-
289
- Python 2 support
290
- =================
291
-
292
- There's no longer support for python 2. Nor planned suppport.
293
-
294
165
Contributing
295
166
============
296
167
@@ -299,4 +170,4 @@ Feel free to create a PR.
299
170
1. Clone the repo.
300
171
2. Add your modifications
301
172
3. Create a virtualenv
302
- 4. Run :code: `pytest -s --cov-report term-missing --cov=commitizen tests/ `
173
+ 4. Run :code: `./scripts/test `
0 commit comments