8000 Merge pull request #18584 from ganesh-k13/doc_18423_lint · numpy/numpy@29d8d93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 29d8d93

Browse files
authored
Merge pull request #18584 from ganesh-k13/doc_18423_lint
DOC: Added documentation for linter (#18423)
2 parents cb7c292 + 482359a commit 29d8d93

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

doc/source/dev/development_environment.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,35 @@ For more extensive information, see :ref:`testing-guidelines`
188188
*Note: do not run the tests from the root directory of your numpy git repo without ``runtests.py``,
189189
that will result in strange test errors.*
190190

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`_
191220

192221
Rebuilding & cleaning the workspace
193222
-----------------------------------
@@ -264,6 +293,8 @@ typically packaged as ``python-dbg``) is highly recommended.
264293
.. _virtualenvwrapper: http://www.doughellmann.com/projects/virtualenvwrapper/
265294
.. _Waf: https://code.google.com/p/waf/
266295
.. _`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
267298

268299
Understanding the code & getting started
269300
----------------------------------------

0 commit comments

Comments
 (0)
0