@@ -17,6 +17,34 @@ You can find the list of bugs, enhancements and feature requests on the
1717`issue tracker <https://github.com/jazzband/django-oauth-toolkit/issues >`_. If you want to fix an issue, pick up one and
1818add a comment stating you're working on it.
1919
20+ Code Style
21+ ==========
22+
23+ The project uses `flake8 <https://flake8.pycqa.org/en/latest/ >`_ for linting,
24+ `black <https://black.readthedocs.io/en/stable/ >`_ for formatting the code,
25+ `isort <https://pycqa.github.io/isort/ >`_ for formatting and sorting imports,
26+ and `pre-commit <https://pre-commit.com/ >`_ for checking/fixing commits for
27+ correctness before they are made.
28+
29+ You will need to install ``pre-commit `` yourself, and then ``pre-commit `` will
30+ take care of installing ``flake8 ``, ``black `` and ``isort ``.
31+
32+ After cloning your repository, go into it and run::
33+
34+ pre-commit install
35+
36+ to install the hooks. On the next commit that you make, ``pre-commit `` will
37+ download and install the necessary hooks (a one off task). If anything in the
38+ commit would fail the hooks, the commit will be abandoned. For ``black `` and
39+ ``isort ``, any necessary changes will be made automatically, but not staged.
40+ Review the changes, and then re-stage and commit again.
41+
42+ Using ``pre-commit `` ensures that code that would fail in QA does not make it
43+ into a commit in the first place, and will save you time in the long run. You
44+ can also (largely) stop worrying about code style, although you should always
45+ check how the code looks after ``black `` has formatted it, and think if there
46+ is a better way to structure the code so that it is more readable.
47+
2048Pull requests
2149=============
2250
0 commit comments