@@ -164,16 +164,27 @@ true for ``*.py`` files. If you change the C-extension source (which might
164
164
also happen if you change branches) you will have to re-run
165
165
``python -m pip install -ve . ``
166
166
167
- Install pre-commit hooks (optional)
168
- ===================================
169
- `pre-commit <https://pre-commit.com/ >`_ hooks automatically check flake8 and
170
- other style issues when you run ``git commit ``. The hooks are defined in the
171
- top level ``.pre-commit-config.yaml `` file. To install the hooks ::
167
+ Install pre-commit hooks
168
+ ========================
169
+ `pre-commit <https://pre-commit.com/ >`_ hooks save time in the review process by
170
+ identifying issues with the code before a pull request is formally opened. Most
171
+ hooks can also aide in fixing the errors, and the checks should have
172
+ corresponding :ref: `development workflow <development-workflow >` and
173
+ :ref: `pull request <pr-guidelines >` guidelines. Hooks are configured in
174
+ `.pre-commit-config.yaml <https://github.com/matplotlib/matplotlib/blob/main/.pre-commit-config.yaml? >`_
175
+ and include checks for spelling and formatting, flake 8 conformity, accidentally
176
+ committed files, import order, and incorrect branching.
177
+
178
+ Install pre-commit hooks ::
172
179
173
180
python -m pip install pre-commit
174
181
pre-commit install
175
182
176
- The hooks can also be run manually. All the hooks can be run, in order as
183
+ Hooks are run automatically after the ``git commit `` stage of the
184
+ :ref: `editing workflow<edit-flow> `. When a hook has found and fixed an error in a
185
+ file, that file must be *staged and committed * again.
186
+
187
+ Hooks can also be run manually. All the hooks can be run, in order as
177
188
listed in ``.pre-commit-config.yaml ``, against the full codebase with ::
178
189
179
190
pre-commit run --all-files
0 commit comments