@@ -5,22 +5,21 @@ PRAW gladly welcomes new contributions. As with most larger projects, we have an
5
5
established consistent way of doing things. A consistent style increases readability,
6
6
decreases bug-potential and makes it faster to understand how everything works together.
7
7
8
- PRAW follows :PEP: `8 ` and :PEP: `257 `. The ``pre_push.py `` script can be used to test for
9
- compliance with these PEPs in addition to providing a few other checks. The following
10
- are PRAW-specific guidelines in addition to those PEP's.
8
+ PRAW follows :PEP: `8 ` and :PEP: `257 `. `Pre-Commit <https://pre-commit.com> ` is used to
9
+ manage a suite of pre-commit hooks that enforce conformance with these PEPs along with
10
+ several other checks. Additionally, the ``pre_push.py `` script can be used to run the
11
+ full pre-commit suite and the docs build prior to submitting a Pull Request. The
12
+ following are PRAW-specific guidelines in addition to those PEPs.
11
13
12
14
.. note ::
13
15
14
- Python 3.6+ is needed to run the script.
15
-
16
- .. note ::
17
-
18
- In order to install the dependencies needed to run the script, you can install the
19
- ``[dev] `` package of praw, like so:
16
+ In order to use the pre-commit hooks and the ``pre_push.py `` dependencies, install
17
+ PRAW's ``[lint] `` extra, followed by the appropriate Pre-Commit command:
20
18
21
19
.. code-block :: bash
22
20
23
- pip install praw[dev]
21
+ pip install praw[lint]
22
+ pre-commit install
24
23
25
24
Code
26
25
----
@@ -78,9 +77,9 @@ The environment variables are (listed in bash export format):
78
77
export prawtest_username=myusername
79
78
export prawtest_user_agent=praw_pytest
80
79
81
- By setting these environment variables prior to running ``python setup.py test ``, when
82
- adding or updating cassettes, instances of ``mypassword `` will be replaced by the
83
- placeholder text ``<PASSWORD> `` and similar for the other environment variables.
80
+ By setting these environment variables prior to running ``pytest ``, when adding or
81
+ updating cassettes, instances of ``mypassword `` will be replaced by the placeholder text
82
+ ``<PASSWORD> `` and similar for the other environment variables.
84
83
85
84
To use tokens instead of username/password set ``prawtest_refresh_token `` instead of
86
85
``prawtest_password `` and ``prawtest_username ``.
@@ -104,8 +103,9 @@ Static Checker
104
103
~~~~~~~~~~~~~~
105
104
106
105
PRAW's test suite comes with a checker tool that can warn you of using incorrect
107
- documentation styles (using ``.. code-block:: `` instead of ``.. code:: ``, using ``/r/ ``
108
- instead of ``r/ ``, etc.).
106
+ documentation styles (using ``.. code:: `` instead of ``.. code-block:: ``, using ``/r/ ``
107
+ instead of ``r/ ``, etc.). This is run automatically by the pre-commit hooks and the
108
+ ``pre_push.py `` script.
109
109
110
110
.. autoclass :: tools.static_word_checks.StaticChecker
111
111
:inherited-members:
0 commit comments