Skip to content

Commit b7c7115

Browse files
authored
MAINT Add pre-commit setup (#111)
1 parent 0742a76 commit b7c7115

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
command: |
1414
black --check examples sklearn_extra *py
1515
# ensure there is no unused imports with flake8
16-
flake8 --select=F401
16+
flake8
1717
1818
workflows:
1919
version: 2

.pre-commit-config.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/psf/black
9+
rev: 20.8b1
10+
hooks:
11+
- id: black
12+
- repo: https://gitlab.com/pycqa/flake8
13+
rev: 3.9.0
14+
hooks:
15+
- id: flake8
16+
types: [file, python]

doc/contributing.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ This is still a very young project, but we do have a few guiding principles:
3737
2. Write detailed docstrings in numpy format
3838
3. Support pandas dataframes and numpy arrays as inputs
3939
4. Write tests
40-
5. Format with black
40+
5. Format with black. You can use `pre-commit <https://pre-commit.com/>`_ to auto-format code on each commit,
41+
42+
.. code-block:: console
43+
44+
pip install pre-commit
45+
pre-commit install
4146
4247
Running Tests
4348
^^^^^^^^^^^^^

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ test = pytest
77
[tool:pytest]
88
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
99
addopts = --doctest-modules
10+
11+
[flake8]
12+
select = F401

0 commit comments

Comments
 (0)