vatlab / varianttools

software tool for the manipulation, annotation, selection, and analysis of variants in the context of next-gen sequencing analysis
https://vatlab.github.io/vat-docs/
GNU General Public License v3.0
31 stars 4 forks source link

git hook for pyflakes and yapf formatter #132

Closed BoPeng closed 5 years ago

BoPeng commented 5 years ago

These will help us keep the source code in good shape.

BoPeng commented 5 years ago

https://github.com/google/yapf/blob/master/plugins/pre-commit.sh

BoPeng commented 5 years ago

https://pre-commit.com/

BoPeng commented 5 years ago

@jma7 Please

  1. Install needed tools using
pip install pre-commit flake8 yapf
  1. Check existing files using
pre-commit run --all-files

or simply

flake8 src/variant_tools/*.py

You can ignore some flake8 warnings in .pre-commit-config.yaml.

The goal is to make sure pre-commit run --all-files does not generate any warning.

Here I am using flake8 because pyflakes is said to be deprecated.

BoPeng commented 5 years ago

Note that you can ignore swig generated .py files such as cgatools.py since your changes would be overwritten by swig. pre-commit documents options to exclude files.

jma7 commented 5 years ago

There is some compatibility issue with pre-commit and virtualenv according to https://github.com/NREL/ditto/issues/147. I have to go through

conda install virtualenv
conda install pre_commit -c conda-forge

to make it work.