Debian Codegraph @

docs/contributing/contributing.md

raw
1 # Contributing to Commitizen
2
3 First, thank you for taking the time to contribute! 🎉 Your contributions help make Commitizen better for everyone.
4
5 When contributing to Commitizen, we encourage you to:
6
7 1. First, check out the [issues](https://github.com/commitizen-tools/commitizen/issues) and [Features we won't add](../features_wont_add.md) to see if there's already a discussion about the change you wish to make.
8 2. If there's no discussion, [create an issue](https://github.com/commitizen-tools/commitizen/issues/new) to discuss your proposed changes.
9 3. Follow our [development workflow](#development-workflow) and guidelines below.
10
11 If you're a first-time contributor, please check out issues labeled [good first issue](https://github.com/commitizen-tools/commitizen/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - these are specifically chosen to be beginner-friendly.
12
13 ## Prerequisites & Setup
14
15 ### Required Tools
16
17 1. **Python Environment**
18 - Python `>=3.10`
19 - [uv](https://docs.astral.sh/uv/getting-started/installation/) `>=0.9.0`
20 2. **Version Control & Security**
21 - Git
22 - Commitizen
23 - [GPG](https://gnupg.org) for commit signing
24 - [Installation page](https://gnupg.org/documentation/manuals/gnupg/Installation.html#Installation)
25 - For Mac users: `brew install gnupg`
26 - For Windows users: Download from [Gpg4win](https://www.gpg4win.org/)
27 - For Linux users: Use your distribution's package manager (e.g., `apt install gnupg` for Ubuntu)
28
29 ### Getting Started
30
31 1. Fork [Commitizen](https://github.com/commitizen-tools/commitizen)
32 2. Clone your fork:
33 ```bash
34 git clone https://github.com/YOUR_USERNAME/commitizen.git
35 cd commitizen
36 ```
37 3. Add the upstream repository:
38 ```bash
39 git remote add upstream https://github.com/commitizen-tools/commitizen.git
40 ```
41 4. Set up the development environment:
42 ```bash
43 uv sync --dev --frozen
44 ```
45 5. Set up pre-commit hooks:
46 ```bash
47 uv run poe setup-pre-commit
48 ```
49
50 ## Development Workflow
51
52 1. **Create a New Branch**
53 ```bash
54 git switch -c feature/your-feature-name
55 # or
56 git switch -c fix/your-bug-fix
57 ```
58 2. **Make Your Changes**
59 - Write your code
60 - Add tests for new functionalities or fixes
61 - Update documentation if needed
62 - Follow the existing code style
63 3. **Testing**
64 - Run the full test suite: `uv run poe all`
65 - Ensure test coverage doesn't drop (we use [CodeCov](https://app.codecov.io/gh/commitizen-tools/commitizen))
66 - For documentation changes, run `uv run poe doc` to check for warnings/errors
67 - If you need to change some file regression snapshots, run: `uv run poe test:regen`
68 4. **Committing Changes**
69 - Use Commitizen to make commits (we follow [conventional commits](https://www.conventionalcommits.org/))
70 - Example: `cz commit`
71 5. **Documentation**
72 - Update `docs/README.md` if needed
73 - For CLI help screenshots: `uv run poe doc:screenshots`
74 - Prefer [Google style documentation](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings), which works well with editors like VSCode and PyCharm
75 - **DO NOT** update `CHANGELOG.md` (automatically generated)
76 - **DO NOT** update version numbers (automatically handled)
77 6. **Pull Request**
78 - Push your changes: `git push origin your-branch-name`
79 - Create a pull request on GitHub
80 - Ensure CI checks pass
81 - Wait for review and address any feedback
82
83 ## Use of GitHub Labels
84
85 * good-first-issue *(issue only)*
86 * help-wanted
87 * issue-status: needs-triage *(issue only)* **(default label for issues)**
88 * issue-status: wont-fix
89 * issue-status: wont-implement
90 * issue-status: duplicate
91 * issue-status: invalid
92 * issue-status: wait-for-response
93 * issue-status: wait-for-implementation
94 * issue-status: pr-created
95 * pr-status: wait-for-review **(default label for PRs)**
96 * pr-status: reviewing
97 * pr-status: wait-for-modification
98 * pr-status: wait-for-response
99 * pr-status: ready-to-merge
100 * needs: test-case *(PR only)*
101 * needs: documentation *(PR only)*
102 * type: feature
103 * type: bug
104 * type: documentation
105 * type: refactor
106 * type: question *(issue only)*
107 * os: Windows
108 * os: Linux
109 * os: macOS
110
111
112 ## Issue life cycle
113
114 ```mermaid
115 graph TD
116 input[/issue created/] -->
117 needs-triage
118 needs-triage --triage--> close(wont-implement, wont-fix, duplicate, invalid)
119
120 needs-triage --triage--> wait-for-implementation
121 needs-triage --triage--> wait-for-response
122
123 wait-for-response --response--> needs-triage
124
125 wait-for-implementation --PR-created--> pr-created --PR-merged--> output[/close/]
126
127 close --> output[/close/]
128 ```
129
130 ## Pull request life cycle
131
132 ```mermaid
133 flowchart TD
134 input[/pull request created/] -->
135 wait-for-review
136 --start reviewing -->
137 reviewing
138 --finish review -->
139 reviewed{approved}
140
141 reviewed --Y-->
142 wait-for-merge -->
143 output[/merge/]
144
145 reviewed --n-->
146 require-more-information{require more information}
147
148 require-more-information --y-->
149 wait-for-response
150 --response-->
151 require-more-information
152
153 require-more-information --n-->
154 wait-for-modification
155 --modification-received-->
156 review
157 ```