Skip to content

Commit

Permalink
[Documentation:Developer] Added python linter pylint to docs (#562)
Browse files Browse the repository at this point in the history
Added documentation of how to use pylint to docs
  • Loading branch information
jason490 authored Dec 1, 2023
1 parent 57d2a5e commit 1bb6b32
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ redirect_from:

__Minimum Version__: 3.8

For Python, we use [flake8](http://flake8.pycqa.org/en/latest/) to check Python code such that it follows things laid out in
[PEP-8](https://www.python.org/dev/peps/pep-0008/), [PEP-257](https://www.python.org/dev/peps/pep-0257/), etc. The code is
linted as part of our automated Travis-CI testsuite to ensure compliance. To locally lint the code, you will need to
install three modules:

pip3 install flake8 flake8-bugbear

For Python, we use [flake8](http://flake8.pycqa.org/en/latest/) and [pylint](https://pylint.readthedocs.io/en/stable/)
to check Python code such that it follows things laid out in [PEP-8](https://www.python.org/dev/peps/pep-0008/),
[PEP-257](https://www.python.org/dev/peps/pep-0257/), etc. The code is linted as part of our automated Travis-CI
testsuite to ensure compliance. To locally lint the code, you will need to install four modules:
```bash
pip3 install flake8 flake8-bugbear pylint
```
and then you can just run `flake8` at the root to check all files or pass it an individual file to check just that.
To see all files that are currently checked as part of Travis-CI, please look at the `.flake8` config file.

For pylint, you can just run `pylint --recursive=y .` at the root to check all files or pass it an individual file.
16 changes: 11 additions & 5 deletions _docs/developer/testing/linting_static_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ Be sure to start with the [Initial Set Up](/developer/testing/#initial-set-up) i

## Python Linting

The Python code of Submitty is linted using [flake8](https://flake8.pycqa.org/en/latest/) and
[flake8-bugbear](https://github.com/PyCQA/flake8-bugbear). You can run the Python linter
locally (on your host operating system) by running the following command from the root
The Python code of Submitty is linted using [flake8](https://flake8.pycqa.org/en/latest/),
[flake8-bugbear](https://github.com/PyCQA/flake8-bugbear), and [pylint](https://pylint.readthedocs.io/en/stable/).
You can run the Python linter locally (on your host operating system) by running the following command from the root
level of Submitty source tree:

```bash
# from root level of Submitty repository
# from root level of Submitty repository using flake8
python3 -m flake8

# from root level of Submitty repository using pylint
python3 -m pylint --recursive=y .
```

_NOTE: Our Travis CI testing currently [excludes a number of legacy source code files](https://github.com/Submitty/Submitty/blob/master/.flake8).
Expand All @@ -29,8 +32,11 @@ from Python linting, though there is effort to bring more and more of them under
Optionally, you can pass in a specific file or directory to only lint that file or directory, e.g.:

```bash
# from root level of Submitty repository... to lint a specific file:
# from root level of Submitty repository... to lint a specific file using flake:
python3 -m flake8 bin/generate_repos.py

# from root level of Submitty repository... to lint a specific file using pylint:
python3 -m pylint bin/generate_repos.py
```

See also: [Python Style Guide](/developer/coding_style_guide/python)
Expand Down

0 comments on commit 1bb6b32

Please sign in to comment.