@@ -8,13 +8,16 @@ documentation improvements, and code enhancements.
8
8
9
9
- [ Code of Conduct] ( #code-of-conduct )
10
10
- [ How to Contribute] ( #how-to-contribute )
11
+ - [ Requirements] ( #requirements )
11
12
- [ Reporting Issues] ( #reporting-issues )
12
13
- [ Suggesting Features] ( #suggesting-features )
13
14
- [ Submitting Pull Requests] ( #submitting-pull-requests )
14
15
- [ Coding Standards] ( #coding-standards )
15
16
- [ Testing] ( #testing )
16
17
- [ Running Tests] ( #running-tests )
17
18
- [ Additional Tips] ( #additional-tips )
19
+ - [ Linting] ( #linting )
20
+ - [ Auto Formatting] ( #auto-formatting )
18
21
- [ Style Guidelines] ( #style-guidelines )
19
22
- [ Acknowledgments] ( #acknowledgments )
20
23
@@ -25,11 +28,33 @@ expectations for participation in this project.
25
28
26
29
## How to Contribute
27
30
31
+ ### Requirements
32
+
33
+ Contributing is meant to be as painless as possible. However, for the
34
+ sake of a nicely readable and unified codebase, there are some extra
35
+ steps needed before anybody can contribute. While the actual application
36
+ itself only requires Python 3 and Git, contributing will require you to
37
+ install additional applications. The following are required in order to
38
+ pass our CI builder:
39
+
40
+ - [ ` ruff ` ] ( https://github.com/astral-sh/ruff )
41
+ - [ ` black ` ] ( https://github.com/psf/black )
42
+
43
+ We understand these opinionated tools may be a bit controversial,
44
+ but these tools help keep consistency and maintain some semblance
45
+ of standardization across the codebase. If you code does not pass the
46
+ CI builder, it will not be allowed to be merged in, so please keep that
47
+ in mind when submitting code.
48
+
28
49
### Reporting Issues
29
50
30
51
If you encounter any bugs or have suggestions for improvements,
31
- please [ open an issue] ( https://github.com/tomice/git-py-stats/issues ) .
32
- When reporting an issue, please include the following:
52
+ please [ open an issue] ( https://github.com/git-quick-stats/git-py-stats/issues ) .
53
+ We recommend opening up an issue regardless of how minor the change
54
+ may be, as it allows us to better track changes in the project.
55
+ You can even submit a pull request immediately after to address the issue.
56
+
57
+ When reporting an issue, please try to include the following:
33
58
34
59
- A clear and descriptive title.
35
60
- A detailed description of the problem or suggestion.
@@ -40,7 +65,13 @@ When reporting an issue, please include the following:
40
65
41
66
Have an idea for a new feature? We'd love to hear it! Please create an issue
42
67
with the tag ` feature request ` and provide as much detail as possible about
43
- the proposed functionality.
68
+ the proposed functionality. One of the maintainers should get back to you
69
+ within a timely manner to discuss the new features.
70
+
71
+ Please note that this project strives to maintain feature parity with the
72
+ parent project, [ ` git-quick-stats ` ] ( https://github.com/git-quick-stats/git-quick-stats/ ) .
73
+ Depending on the change, we may ask you to first submit the feature request
74
+ to the parent project before we adopt it.
44
75
45
76
### Submitting Pull Requests
46
77
@@ -82,15 +113,21 @@ Contributions are made via pull requests. Here's how to submit one:
82
113
git commit -m " Add feature: description of your feature"
83
114
```
84
115
85
- 6 . ** Push to Your Fork**
116
+ Please note that GitHub has [ built-in keywords] ( https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue )
117
+ that allow you to automatically link an issue to a commit message.
118
+ Making use of these makes it easier to see exactly what each
119
+ commit is attempting to address.
120
+
121
+ 7 . ** Push to Your Fork**
86
122
87
123
``` bash
88
124
git push origin feature/your-feature-name
89
125
```
90
126
91
- 7 . ** Open a Pull Request**
127
+ 8 . ** Open a Pull Request**
92
128
93
- Navigate to the original repository and click on "New Pull Request".
129
+ Navigate to the original repository and click on "New Pull Request",
130
+ or try [ this link] ( https://github.com/git-quick-stats/git-py-stats/compare ) .
94
131
Provide a clear description of your changes and reference any related issues
95
132
should they exist.
96
133
@@ -139,15 +176,15 @@ Ensure that all tests pass before submitting a pull request.
139
176
within the ` git_py_stats/tests/` directory:
140
177
141
178
` ` ` bash
142
- python3 -m unittest discover -s git_py_stats/tests
179
+ python -m unittest discover -s git_py_stats/tests
143
180
` ` `
144
181
145
182
3. ** Run a Specific Test File** :
146
183
147
184
To run a specific test file, you can use:
148
185
149
186
` ` ` bash
150
- python3 -m unittest git_py_stats.tests.test_generate_cmds
187
+ python -m unittest git_py_stats.tests.test_generate_cmds
151
188
` ` `
152
189
153
190
# ## Additional Tips
@@ -156,20 +193,77 @@ Ensure that all tests pass before submitting a pull request.
156
193
- To view more detailed output, use the ` -v` (verbose) flag:
157
194
158
195
` ` ` bash
159
- python3 -m unittest discover -s git_py_stats/tests -v
196
+ python -m unittest discover -s git_py_stats/tests -v
160
197
` ` `
161
198
162
199
- To run all tests automatically and display a summary of results:
163
200
164
201
` ` ` bash
165
- python3 -m unittest discover -s git_py_stats/tests
202
+ python -m unittest discover -s git_py_stats/tests
166
203
` ` `
167
204
168
205
- If you need help writing tests, here are tutorials and books that might help:
169
206
- [Python' s unittest docs](https://docs.python.org/3/library/unittest.html)
170
207
- [Python' s unittest.mock docs](https://docs.python.org/3/library/unittest.mock.html)
171
208
- [Obey the Testing Goat](https://www.obeythetestinggoat.com/pages/book.html#toc)
172
209
210
+ # # Linting
211
+
212
+ As stated before, we use ` ruff` for linting. Installing ` ruff` will depend on
213
+ your system and how you want to manage your dependencies in general. Ubuntu
214
+ and Fedora can use [snaps](https://snapcraft.io/install/ruff/ubuntu),
215
+ Arch can use [pacman](https://archlinux.org/packages/extra/x86_64/ruff/),
216
+ and of course, anybody can use [PyPI](https://pypi.org/project/ruff/).
217
+
218
+ Ultimately, it is up to you how you wish to install ` ruff` , but it is required
219
+ to pass in order to be able to get past our CI builder.
220
+
221
+ Once ` ruff` is installed, you can invoke it by running the following command
222
+ inside the ` git-py-stats` repo:
223
+
224
+ ` ` ` sh
225
+ ruff check git_py_stats
226
+ ` ` `
227
+
228
+ If it passes, ` ruff` will print out " All checks passed!" If it gives an
229
+ error, it will point you to where the issue is and mention the problem.
230
+
231
+ Sometimes, minor issues can be fixed using the ` --fix` flag. ` ruff` will
232
+ try to point these out and fix them for you. Feel free to use this option,
233
+ but realize it might conflict with ` black` , so always try to run the linter
234
+ and get that to pass before running it through the auto formatter.
235
+
236
+ # # Auto Formatting
237
+
238
+ Like earlier, we are opinionated on how the code should look. As such, we
239
+ have a highly opinionated auto formatter thanks to ` black` . Just like with
240
+ ` ruff` , installing ` black` will depend on your system and how you want to
241
+ manage dependencies. You can see how to install it on a slew of different
242
+ operating systems [here](https://snapcraft.io/black). Like nearly all Python
243
+ projects, there is also a [PyPI](https://pypi.org/project/black/) equivalent.
244
+
245
+ Install this however you wish, but your code must pass ` black` ' s default
246
+ auto formatter settings in order to be able to pass our CI builder.
247
+
248
+ Once `black` is installed, you can invoke it by running the following command
249
+ inside the `git-py-stats` repo:
250
+
251
+ ```sh
252
+ black .
253
+ ```
254
+
255
+ It should report back something similar to the following:
256
+
257
+ ```sh
258
+ All done! ✨ 🍰 ✨
259
+ 21 files left unchanged.
260
+ ```
261
+
262
+ That' s it! If there were any changes, commit them. Do * not* try to re-adjust
263
+ anything as that might break the auto formatting you just applied.
264
+
265
+ Once that' s done, your code is finally ready for a pull request!
266
+
173
267
## Style Guidelines
174
268
175
269
- Write clear and concise code.
0 commit comments