24
loading...
This website collects cookies to deliver better user experience
pip install pytest
pytest test_helpers.py
test_helpers.py .... [100%]
========= 4 passed in 0.01s ===========
astroid.exceptions.TooManyLevelsError:
pip uninstall astroid
pip install astroid
pip uninstall pytest
pip install pytest
pip install yapf
yapf --in-place *.py
yapf --in-place **/*.py
pip install isort
isort .
pip install autoflake
autoflake --in-place --remove-unused-variables --remove-all-unused-imports *.py
pip install pylint
pylint --fail-under=7 *.py
--fail-under
is the lower bound, if any file has a score below the lower bound, an error will be returned.pip install pre-commit
pre-commit sample-config
pre-commit install
repos:
- repo: local
hooks:
hooks:
in the YAML file. Below is the general syntax for the plugin- id: (unique id of hook)
name: (name to be displayed in terminal)
entry: (command to excute)
language: system (for our case, always system)
always_run: true (if true, it will always run)
pass_filenames: true (if true, hook will have access to the file name)
- id: YAPF
name: YAPF 🧹
entry: zsh -c 'yapf --in-place *.py'
language: system
always_run: true
pass_filenames: true
Whenever you update your YAML file, you will have to add the file to the staging area using git add . or git add .pre-commit-config.yaml