Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation:Developer] Added python linter pylint to docs #562

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading