From 1bb6b32b26a1c6367eb8e91dcb3a3b0c8cc91c32 Mon Sep 17 00:00:00 2001 From: Jason Ng <116290832+jason490@users.noreply.github.com> Date: Fri, 1 Dec 2023 14:51:33 -0500 Subject: [PATCH] [Documentation:Developer] Added python linter pylint to docs (#562) Added documentation of how to use pylint to docs --- .../coding_style_guide/python.md | 16 +++++++++------- .../developer/testing/linting_static_analysis.md | 16 +++++++++++----- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/_docs/developer/software_and_system_design/coding_style_guide/python.md b/_docs/developer/software_and_system_design/coding_style_guide/python.md index 3f8ab330..f6ec3d7d 100644 --- a/_docs/developer/software_and_system_design/coding_style_guide/python.md +++ b/_docs/developer/software_and_system_design/coding_style_guide/python.md @@ -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. \ No newline at end of file diff --git a/_docs/developer/testing/linting_static_analysis.md b/_docs/developer/testing/linting_static_analysis.md index 23c992c1..968ebfe4 100644 --- a/_docs/developer/testing/linting_static_analysis.md +++ b/_docs/developer/testing/linting_static_analysis.md @@ -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). @@ -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)