Skip to content

Commit 8e2fb46

Browse files
committed
reformat contributing doc
1 parent 295e1e7 commit 8e2fb46

File tree

1 file changed

+119
-82
lines changed

1 file changed

+119
-82
lines changed

CONTRIBUTING.rst

Lines changed: 119 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,108 @@ How to contribute to Flask
33

44
Thank you for considering contributing to Flask!
55

6+
67
Support questions
78
-----------------
89

910
Please, don't use the issue tracker for this. Use one of the following
1011
resources for questions about your own code:
1112

12-
* The ``#get-help`` channel on our Discord chat: https://discordapp.com/invite/t6rrQZH
13+
- The ``#get-help`` channel on our Discord chat:
14+
https://discord.gg/t6rrQZH
1315

14-
* The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but
15-
Discord is preferred.
16+
- The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but
17+
Discord is preferred.
1618

17-
* The mailing list [email protected] for long term discussion or larger issues.
18-
* Ask on `Stack Overflow`_. Search with Google first using:
19-
``site:stackoverflow.com flask {search term, exception message, etc.}``
19+
- The mailing list [email protected] for long term discussion or larger
20+
issues.
21+
- Ask on `Stack Overflow`_. Search with Google first using:
22+
``site:stackoverflow.com flask {search term, exception message, etc.}``
2023

2124
.. _Stack Overflow: https://stackoverflow.com/questions/tagged/flask?sort=linked
2225

26+
2327
Reporting issues
2428
----------------
2529

26-
- Describe what you expected to happen.
27-
- If possible, include a `minimal reproducible example`_ to help us
28-
identify the issue. This also helps check that the issue is not with
29-
your own code.
30-
- Describe what actually happened. Include the full traceback if there was an
31-
exception.
32-
- List your Python, Flask, and Werkzeug versions. If possible, check if this
33-
issue is already fixed in the repository.
30+
- Describe what you expected to happen.
31+
- If possible, include a `minimal reproducible example`_ to help us
32+
identify the issue. This also helps check that the issue is not with
33+
your own code.
34+
- Describe what actually happened. Include the full traceback if there
35+
was an exception.
36+
- List your Python, Flask, and Werkzeug versions. If possible, check
37+
if this issue is already fixed in the repository.
3438

3539
.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example
3640

41+
3742
Submitting patches
3843
------------------
3944

40-
- Use `Black`_ to autoformat your code. This should be done for you as a
41-
git `pre-commit`_ hook, which gets installed when you run ``pip install -e .[dev]``.
42-
You may also wish to use Black's `Editor integration`_.
43-
- Include tests if your patch is supposed to solve a bug, and explain
44-
clearly under which circumstances the bug happens. Make sure the test fails
45-
without your patch.
46-
- Include a string like "Fixes #123" in your commit message
47-
(where 123 is the issue you fixed).
48-
See `Closing issues using keywords
49-
<https://help.github.com/articles/creating-a-pull-request/>`__.
45+
- Use `Black`_ to autoformat your code. This should be done for you as
46+
a Git `pre-commit`_ hook, set up below. You may also wish to use
47+
Black's `Editor integration`_.
48+
- Include tests if your patch is supposed to solve a bug, and explain
49+
clearly under which circumstances the bug happens. Make sure the
50+
test fails without your patch.
51+
- Include a string like "Fixes #123" in your commit message (where 123
52+
is the issue you fixed). See `Closing issues using keywords
53+
<https://help.github.com/articles/creating-a-pull-request/>`__.
54+
5055

5156
First time setup
5257
~~~~~~~~~~~~~~~~
5358

54-
- Download and install the `latest version of git`_.
55-
- Configure git with your `username`_ and `email`_::
59+
- Download and install the `latest version of git`_.
60+
- Configure git with your `username`_ and `email`_.
61+
62+
.. code-block:: text
63+
64+
$ git config --global user.name 'your name'
65+
$ git config --global user.email 'your email'
66+
67+
- Make sure you have a `GitHub account`_.
68+
- Fork Flask to your GitHub account by clicking the `Fork`_ button.
69+
- `Clone`_ your GitHub fork locally.
5670

57-
git config --global user.name 'your name'
58-
git config --global user.email 'your email'
71+
.. code-block:: text
5972
60-
- Make sure you have a `GitHub account`_.
61-
- Fork Flask to your GitHub account by clicking the `Fork`_ button.
62-
- `Clone`_ your GitHub fork locally::
73+
$ git clone https://github.com/{username}/flask
74+
$ cd flask
6375
64-
git clone https://github.com/{username}/flask
65-
cd flask
76+
- Add the main repository as a remote to update later::
6677

67-
- Add the main repository as a remote to update later::
78+
.. code-block:: text
6879

6980
git remote add pallets https://github.com/pallets/flask
7081
git fetch pallets
7182

72-
- Create a virtualenv::
83+
- Create a virtualenv.
84+
85+
.. code-block:: text
86+
87+
$ python3 -m venv env
88+
$ . env/bin/activate
89+
90+
On Windows, activating is different.
91+
92+
.. code-block:: text
93+
94+
> env\Scripts\activate
95+
96+
- Install Flask in editable mode with development dependencies.
7397

74-
python3 -m venv env
75-
. env/bin/activate
76-
# or "env\Scripts\activate" on Windows
98+
.. code-block:: text
7799
78-
- Install Flask in editable mode with development dependencies::
100+
$ pip install -e ".[dev]"
79101
80-
pip install -e ".[dev]"
102+
- Install the `pre-commit framework`_.
103+
- Install the pre-commit hooks.
81104

82-
- Install the `pre-commit framework`_.
83-
- Install the pre-commit hooks::
105+
.. code-block:: text
84106
85-
pre-commit install --install-hooks
107+
$ pre-commit install
86108
87109
.. _GitHub account: https://github.com/join
88110
.. _latest version of git: https://git-scm.com/downloads
@@ -92,66 +114,79 @@ First time setup
92114
.. _Clone: https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork
93115
.. _pre-commit framework: https://pre-commit.com/#install
94116

117+
95118
Start coding
96119
~~~~~~~~~~~~
97120

98121
- Create a branch to identify the issue you would like to work on. If
99122
you're submitting a bug or documentation fix, branch off of the
100-
latest ".x" branch::
123+
latest ".x" branch.
124+
125+
.. code-block:: text
101126
102-
git checkout -b your-branch-name origin/1.0.x
127+
$ git checkout -b your-branch-name origin/1.0.x
103128
104129
If you're submitting a feature addition or change, branch off of the
105-
"master" branch::
130+
"master" branch.
131+
132+
.. code-block:: text
106133
107-
git checkout -b your-branch-name origin/master
134+
$ git checkout -b your-branch-name origin/master
108135
109-
- Using your favorite editor, make your changes, `committing as you go`_.
110-
- Include tests that cover any code changes you make. Make sure the test fails
111-
without your patch. `Run the tests <contributing-testsuite_>`_.
112-
- Push your commits to GitHub and `create a pull request`_ by using::
136+
- Using your favorite editor, make your changes,
137+
`committing as you go`_.
138+
- Include tests that cover any code changes you make. Make sure the
139+
test fails without your patch.
140+
`Run the tests <contributing-testsuite_>`_.
141+
- Push your commits to GitHub and `create a pull request`_.
113142

114-
git push --set-upstream origin your-branch-name
143+
.. code-block:: text
115144
116-
- Celebrate 🎉
145+
$ git push --set-upstream origin your-branch-name
117146
118147
.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes
119148
.. _Black: https://black.readthedocs.io
120149
.. _Editor integration: https://black.readthedocs.io/en/stable/editor_integration.html
121150
.. _pre-commit: https://pre-commit.com
122151
.. _create a pull request: https://help.github.com/en/articles/creating-a-pull-request
123152

153+
124154
.. _contributing-testsuite: #running-the-tests
125155

126156
Running the tests
127157
~~~~~~~~~~~~~~~~~
128158

129-
Run the basic test suite with::
159+
Run the basic test suite with pytest.
160+
161+
.. code-block:: text
130162
131-
pytest
163+
$ pytest
132164
133-
This only runs the tests for the current environment. Whether this is relevant
134-
depends on which part of Flask you're working on. Travis-CI will run the full
135-
suite when you submit your pull request.
165+
This only runs the tests for the current environment. Whether this is
166+
relevant depends on which part of Flask you're working on. CI will run
167+
the full suite when you submit your pull request.
136168

137169
The full test suite takes a long time to run because it tests multiple
138170
combinations of Python and dependencies. If you don't have a Python
139171
version installed, it will be skipped with a warning message at the end.
140-
Run::
141172

142-
tox
173+
.. code-block:: text
174+
175+
$ tox
176+
143177
144178
Running test coverage
145179
~~~~~~~~~~~~~~~~~~~~~
146180

147181
Generating a report of lines that do not have test coverage can indicate
148-
where to start contributing. Run ``pytest`` using ``coverage`` and generate a
149-
report on the terminal and as an interactive HTML document::
182+
where to start contributing. Run ``pytest`` using ``coverage`` and
183+
generate a report on the terminal and as an interactive HTML document.
184+
185+
.. code-block:: text
150186
151-
coverage run -m pytest
152-
coverage report
153-
coverage html
154-
# then open htmlcov/index.html
187+
$ coverage run -m pytest
188+
$ coverage report
189+
$ coverage html # then open htmlcov/index.html
155190
156191
Read more about `coverage <https://coverage.readthedocs.io>`_.
157192

@@ -162,11 +197,12 @@ from all runs.
162197
Building the docs
163198
~~~~~~~~~~~~~~~~~
164199

165-
Build the docs in the ``docs`` directory using Sphinx::
200+
Build the docs in the ``docs`` directory using Sphinx.
201+
202+
.. code-block:: text
166203
167-
cd docs
168-
pip install -r requirements.txt
169-
make html
204+
$ cd docs
205+
$ make html
170206
171207
Open ``_build/html/index.html`` in your browser to view the docs.
172208

@@ -176,22 +212,23 @@ Read more about `Sphinx <https://www.sphinx-doc.org/en/master/>`_.
176212
Caution: zero-padded file modes
177213
-------------------------------
178214

179-
This repository contains several zero-padded file modes that may cause issues
180-
when pushing this repository to git hosts other than GitHub. Fixing this is
181-
destructive to the commit history, so we suggest ignoring these warnings. If it
182-
fails to push and you're using a self-hosted git service like GitLab, you can
183-
turn off repository checks in the admin panel.
215+
This repository contains several zero-padded file modes that may cause
216+
issues when pushing this repository to Git hosts other than GitHub.
217+
Fixing this is destructive to the commit history, so we suggest ignoring
218+
these warnings. If it fails to push and you're using a self-hosted Git
219+
service like GitLab, you can turn off repository checks in the admin
220+
panel.
184221

185-
These files can also cause issues while cloning. If you have ::
222+
These files can also cause issues while cloning if you have
223+
``fsckObjects`` enabled with either of the following in your git config.
186224

187-
[fetch]
188-
fsckobjects = true
225+
.. code-block::
189226
190-
or ::
227+
[fetch]
228+
fsckObjects = true
191229
192230
[receive]
193231
fsckObjects = true
194232
195-
set in your git configuration file, cloning this repository will fail. The only
196-
solution is to set both of the above settings to false while cloning, and then
197-
setting them back to true after the cloning is finished.
233+
The only solution is to set both of the above to ``false``, clone, and
234+
then set them back to ``true`` after.

0 commit comments

Comments
 (0)