@@ -188,6 +188,35 @@ For more extensive information, see :ref:`testing-guidelines`
188
188
*Note: do not run the tests from the root directory of your numpy git repo without ``runtests.py``,
189
189
that will result in strange test errors. *
190
190
191
+ Running Linting
192
+ ---------------
193
+ Lint checks can be performed on newly added lines of Python code.
194
+
195
+ Install all dependent packages using pip::
196
+
197
+ $ python -m pip install -r linter_requirements.txt
198
+
199
+ To run lint checks before committing new code, run::
200
+
201
+ $ python runtests.py --lint uncommitted
202
+
203
+ To check all changes in newly added Python code of current branch with target branch, run::
204
+
205
+ $ python runtests.py --lint main
206
+
207
+ If there are no errors, the script exits with no message. In case of errors::
208
+
209
+ $ python runtests.py --lint main
210
+ ./numpy/core/tests/test_scalarmath.py:34:5: E303 too many blank lines (3)
211
+ 1 E303 too many blank lines (3)
212
+
213
+ It is advisable to run lint checks before pushing commits to a remote branch
214
+ since the linter runs as part of the CI pipeline.
215
+
216
+ For more details on Style Guidelines:
217
+
218
+ - `Python Style Guide `_
219
+ - `C Style Guide `_
191
220
192
221
Rebuilding & cleaning the workspace
193
222
-----------------------------------
@@ -264,6 +293,8 @@ typically packaged as ``python-dbg``) is highly recommended.
264
293
.. _virtualenvwrapper : http://www.doughellmann.com/projects/virtualenvwrapper/
265
294
.. _Waf : https://code.google.com/p/waf/
266
295
.. _`match test names using python operators` : https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests
296
+ .. _`Python Style Guide` : https://www.python.org/dev/peps/pep-0008/
297
+ .. _`C Style Guide` : https://numpy.org/neps/nep-0045-c_style_guide.html
267
298
268
299
Understanding the code & getting started
269
300
----------------------------------------
0 commit comments