Added code quality checks to contributing.md (#121)

This commit is contained in:
Karl Weinmeister
2021-11-01 09:26:40 -07:00
committed by GitHub
parent b4d901d725
commit 09795308ab
+29
View File
@@ -15,6 +15,35 @@ You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code Quality Checks
All notebooks in this project are checked for formatting and style, to ensure a
consistent experience. To test notebooks prior to submitting a pull request,
you can follow these steps.
From a command-line terminal (e.g. from Vertex Workbench or locally), install
the code analysis tools:
```shell
pip install -U nbqa black flake8 isort pyupgrade git+https://github.com/tensorflow/docs
```
Then, set an environment variable for your notebook (or directory):
```shell
export notebook="your-notebook.ipynb"
```
Finally, run this code block to check for errors. Each step will attempt to
automatically fix any issues. If the fixes can't be performed automatically,
then you will need to manually address them before submitting your PR.
```shell
nbqa black "$notebook"
nbqa pyupgrade "$notebook"
nbqa isort "$notebook"
python3 -m tensorflow_docs.tools.nbfmt --remove_outputs "$notebook"
nbqa flake8 "$notebook" --extend-ignore=W391,E501,F821,E402,F404,W503,E203,E722,W293,W291
```
## Code Reviews
All submissions, including submissions by project members, require review. We