Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changes to developer workflow (peep and pre-commit) [action required]

5 views
Skip to first unread message

Michael Cooper

unread,
Apr 10, 2015, 5:10:28 PM4/10/15
to dev-...@lists.mozilla.org
Hey all,

Two fun changes landed recently, and you should do something about them.

First, we are now using a slightly modified version of Fjord's
peep.sh. This is a wrapper around peep.py that makes the UI a little
nicer. This takes care of all that weirdness about versions and
options. So now instead of

$ python scripts/peep.py install -r requirements/dev.txt -r
requirements/default.txt --no-use-wheel

you should do

$ ./peep.sh install -r requirements/dev.txt -r requirements/default.txt

peep.sh will make sure to use the --no-use-wheel flag and a couple
other things to make sure we are all using the same install methods,
regardless of what version of Pip, Peep, and Virtualenv you might
have.

Second, the pre-commit hook has been replaced again. We are still
using flake8 for linting, but the tools that run pre-commit have been
switched to Yelp's Pre-commit project. It is a lot smarter about when
to run things, has a lot more checks, and is really extensible.

Assuming you either a) have no pre-commit hooks, or b) have our
standard pre-commit hook (the one that used to live in scripts/), you
should do this:

$ ./peep.sh install -r requirements/defaults.txt -r requirements/dev.txt
$ pre-commit install -f

`pre-commit` should be on your path, thanks to pip. If not, check the
bin directory of your virtualenv (also, fix your environment). Among
other nice things, Pre-commit only runs on the changes you are going
to commit, which should help with partial commits, and `--amend`. For
more info, check out the hacking how to, which goes into a little more
detail, the Pre-commit docs, or our configuration for .pre-commit, in
`.pre-commit-config.yaml`. It's pretty cool.

If, for whatever reason, you need to skip pre-commit checks for a
commit, you can still use --no-verify, however there is now a better
way. You can skip just some checks, like

$ SKIP=flake8,check-yaml git commit

Keep in mind that Travis is still going to run the lint checks, so
only do this if you are smarter than your Git hook.

Happy linting!
--Mythmon
0 new messages