Skip to content

Commit

Permalink
Merge pull request #2790 from SauravMaheshkar/add-precommit
Browse files Browse the repository at this point in the history
Add precommit
  • Loading branch information
rbharath committed Dec 15, 2021
2 parents 8baa586 + 1f43aa0 commit f8811ff
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.22.0
hooks:
- id: yapf

- repo: https://gitlab.com/PyCQA/flake8
rev: 3.8.4
hooks:
- id: flake8
args: [--count]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
hooks:
- id: mypy
args: [--ignore-missing-imports]
21 changes: 21 additions & 0 deletions docs/source/development_guide/coding.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Coding Conventions
==================

Pre-Commit
-----------

.. _`Pre-Commit`: https://pre-commit.com/

We use `pre-commit`_ to ensure that we're always keeping up with the best
practices when it comes to linting, standard code conventions and type
annotations. Although it may seem time consuming at first as to why is one
supposed to run all these tests and checks but it helps in identifying simple
issues before submission to code review. We've already specified a configuration
file with a list of hooks that will get executed before every commit.

First you'll need to setup the git hook scripts by installing them.

.. code-block:: bash
pre-commit install
Now whenever you commit, pre-commit will run the necessary hooks on the modified
files.

Code Formatting
---------------

Expand Down
1 change: 1 addition & 0 deletions env.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- rdkit
- mdtraj
- numpy==1.19.*
- pre-commit
- pip==20.2.*
- pip:
- biopython
Expand Down

0 comments on commit f8811ff

Please sign in to comment.