Skip to content

Commit

Permalink
Update both contributing guides to reflect addition of pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Sep 14, 2021
1 parent ac753b8 commit f016b0d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
15 changes: 10 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ One of the simplest ways to help with PRAW is by answering others'
questions. When responding, always be positive. While something may be obvious
to you, it likely is not to the person asking the question.

## Pull Request Creation
## Creating Pull Requests

0. If you are fixing an already filed issue, please indicate your intentions by
commenting on the issue. This act will hopefully minimize any duplicate
work.

0. Prior to creating a pull request run the `pre_push.py` script. This script
depends on the tools `black` `flake8`, `pylint`, `pydocstyle`, `sphinx` and `sphinx_rtd_theme`. They can
be installed via `pip install black flake8 pydocstyle pylint sphinx sphinx_rtd_theme` or via
`pip install praw[lint]`.
0. Before commiting, make sure to install [Pre-Commit](https://pre-commit.com/)
and the pre-commit hooks, which ensure any new code conforms to PRAW's
quality and style guidelines. To do so, install the linting dependencies
with `pip install praw[lint]`, then by the hooks with `pre-commit install`.
They will now run automatically every time you commit.

0. Prior to creating a pull request, run the `pre_push.py` script.
This runs the pre-commit suite on all files, as well as builds the docs.
You'll need to have installed the linting dependencies first (see previous).

0. Add yourself as a contributor to the ``AUTHORS.rst``.

Expand Down
28 changes: 14 additions & 14 deletions docs/package_info/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ PRAW gladly welcomes new contributions. As with most larger projects, we have an
established consistent way of doing things. A consistent style increases readability,
decreases bug-potential and makes it faster to understand how everything works together.

PRAW follows :PEP:`8` and :PEP:`257`. The ``pre_push.py`` script can be used to test for
compliance with these PEPs in addition to providing a few other checks. The following
are PRAW-specific guidelines in addition to those PEP's.
PRAW follows :PEP:`8` and :PEP:`257`. `Pre-Commit <https://pre-commit.com>` is used to
manage a suite of pre-commit hooks that enforce conformance with these PEPs along with
several other checks. Additionally, the ``pre_push.py`` script can be used to run the
full pre-commit suite and the docs build prior to submitting a Pull Request. The
following are PRAW-specific guidelines in addition to those PEPs.

.. note::

Python 3.6+ is needed to run the script.

.. note::

In order to install the dependencies needed to run the script, you can install the
``[dev]`` package of praw, like so:
In order to use the pre-commit hooks and the ``pre_push.py`` dependencies, install
PRAW's ``[lint]`` extra, followed by the appropriate Pre-Commit command:

.. code-block:: bash
pip install praw[dev]
pip install praw[lint]
pre-commit install
Code
----
Expand Down Expand Up @@ -78,9 +77,9 @@ The environment variables are (listed in bash export format):
export prawtest_username=myusername
export prawtest_user_agent=praw_pytest
By setting these environment variables prior to running ``python setup.py test``, when
adding or updating cassettes, instances of ``mypassword`` will be replaced by the
placeholder text ``<PASSWORD>`` and similar for the other environment variables.
By setting these environment variables prior to running ``pytest``, when adding or
updating cassettes, instances of ``mypassword`` will be replaced by the placeholder text
``<PASSWORD>`` and similar for the other environment variables.

To use tokens instead of username/password set ``prawtest_refresh_token`` instead of
``prawtest_password`` and ``prawtest_username``.
Expand All @@ -105,7 +104,8 @@ Static Checker

PRAW's test suite comes with a checker tool that can warn you of using incorrect
documentation styles (using ``.. code-block::`` instead of ``.. code::``, using ``/r/``
instead of ``r/``, etc.).
instead of ``r/``, etc.). This is run automatically by the pre-commit hooks and the
``pre_push.py`` script.

.. autoclass:: tools.static_word_checks.StaticChecker
:inherited-members:
Expand Down

0 comments on commit f016b0d

Please sign in to comment.