Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
[bug 1133121] Use Yelp's pre-commit to provide pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
lgp171188 committed Apr 20, 2015
1 parent 76866fb commit 105a3a5
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 126 deletions.
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: 2d83e302cc2757a28cedc03e6bb075de913c1804
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- id: flake8
exclude: "\
(fjord/settings*)|\
(.*migrations.*)|\
(bin/peep-2.2.py)|\
(bin/update/update.py)|\
(smoketests/.*)|\
(vendor/.*)|\
(docs/.*)"
args: [--max-line-length=79]

- repo: https://github.com/pre-commit/mirrors-jshint
sha: 'v2.6.3'
hooks:
- id: jshint
51 changes: 0 additions & 51 deletions bin/flake8_lint.sh

This file was deleted.

64 changes: 0 additions & 64 deletions bin/hooks/lint.pre-commit

This file was deleted.

3 changes: 2 additions & 1 deletion bin/vagrant_provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ VENV=/home/vagrant/.virtualenvs/fjordvagrant
sudo -H -u vagrant virtualenv $VENV

# Install bits we need for compiled requirements
apt-get install -y -q libxml2 libxml2-dev libxslt1.1 libxslt1-dev
apt-get install -y -q libxml2 libxml2-dev libxslt1.1 libxslt1-dev libyaml-dev

# Install Fjord requirements
sudo -H -u vagrant -s -- <<EOF
Expand All @@ -64,6 +64,7 @@ cd ~/fjord
./peep.sh install -r requirements/requirements.txt
./peep.sh install -r requirements/compiled.txt
./peep.sh install -r requirements/dev.txt
pre-commit install -f
EOF

# Install Elasticsearch 0.90.10
Expand Down
12 changes: 5 additions & 7 deletions docs/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Git pre-commit hook
-------------------

We have a Git pre-commit hook that makes it easier to make sure you're
checking in linted code. To set it up, run::
checking in linted code. To set it up, run this command in the VM::

$ ./bin/hooks/lint.pre-commit
$ pre-commit install

That'll set up the pre-commit hook. After that, every time you commit
something in Git, it'll run the hook first and if everything is fine
continue with the commit. If things are not fine, it'll notify you and
stop.
stop. In case, you had already installed the previous pre-commit hook
overwrite it by using the -f flag with the above command.


Python conventions
Expand All @@ -37,10 +38,7 @@ Follow `PEP-8 <http://python.org/dev/peps/pep-0008/>`_ for code and
If you don't have an editor that checks PEP-8 issues and runs pyflakes
for you, it's worth setting it up.

You can also use the linting script ``bin/flake8_lint.sh``::

$ ./bin/flake8_lint.sh <files-to-lint>

The pre-commit hook uses the ``flake8`` tool to lint the code to be committed.

JavaScript
----------
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"type": "git",
"url": "git://github.com/mozilla/fjord.git"
},
"devDependencies": {
"jshint": "2.5.10"
},
"dependencies": {
"less": "1.7.0"
}
Expand Down
24 changes: 24 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@ django-sslserver==0.14

# sha256: ku47hrXBkhwtnawhe--JkMX4Usi8TZAYyv4PPzuBzTo
nosenicedots==0.5

# sha256: jnbbT3Kv6QCHxHRntYjQ3j2_hvbj7nYqok7KqmyhuwM
pre-commit==0.4.4

# sha256: qRNwGDrqY8h9hIfns5ntLZmnwvFLEI0nwLyK2e9ZXZo
aspy.yaml==0.2.1

# sha256: 6gYn4M8e_0ZftBZrbt3sQW4dq48w1kucWz_6uJgHJmE
cached-property==1.1.0

# sha256: Epii8bL0xKe5IczNFZ5OQvbXsPt1yGwM3s_HHwYYM_o
jsonschema==2.4.0

# sha256: z-plZ1KzlnhB98MAocl1ZSYBPuGfOsR9srdxNP84tQk
nodeenv==0.13.1

# sha256: w2yTiocuX_SUk4szsUqqFWy0OexnVI_Ks1Nbt4sIRug
pyyaml==3.11

# sha256: PIjPffEUwyzwZR0S-Xm421VtmS1kdJPlvbvigovkAAc
virtualenv==12.1.1

# sha256: PkWmgeXnnrMfCUsxhDNG7Zo95Of2682hDHSLPEXFWX4
simplejson==3.0.7

0 comments on commit 105a3a5

Please sign in to comment.