@@ -635,6 +635,8 @@ many errors as possible, but it may not correct *all* of them. Thus, it is
635
635
recommended that you run ``cpplint `` to double check and make any other style
636
636
fixes manually.
637
637
638
+ .. _contributing.code-formatting :
639
+
638
640
Python (PEP8 / black)
639
641
~~~~~~~~~~~~~~~~~~~~~
640
642
@@ -656,6 +658,9 @@ apply ``black`` as you edit files.
656
658
You should use a ``black `` version >= 19.10b0 as previous versions are not compatible
657
659
with the pandas codebase.
658
660
661
+ If you wish to run these checks automatically, we encourage you to use
662
+ :ref: `pre-commits <contributing.pre-commit >` instead.
663
+
659
664
One caveat about ``git diff upstream/master -u -- "*.py" | flake8 --diff ``: this
660
665
command will catch any stylistic errors in your changes specifically, but
661
666
be beware it may not catch all of them. For example, if you delete the only
@@ -727,14 +732,16 @@ to automatically format imports correctly. This will modify your local copy of t
727
732
728
733
The `--recursive ` flag can be passed to sort all files in a directory.
729
734
730
- Alternatively, you can run a command similar to what was suggested for ``black `` and ``flake8 `` right above::
735
+ Alternatively, you can run a command similar to what was suggested for ``black `` and ``flake8 `` :ref: ` right above < contributing.code-formatting >` ::
731
736
732
737
git diff upstream/master --name-only -- "*.py" | xargs -r isort
733
738
734
739
Where similar caveats apply if you are on OSX or Windows.
735
740
736
741
You can then verify the changes look ok, then git :ref: `commit <contributing.commit-code >` and :ref: `push <contributing.push-code >`.
737
742
743
+ .. _contributing.pre-commit :
744
+
738
745
Pre-Commit
739
746
~~~~~~~~~~
740
747
0 commit comments