Skip to content

Commit ae65f55

Browse files
authoredSep 30, 2020
Add pre-commit hook for TheAlgorithms/Python (TheAlgorithms#2511)
* Add pre-commit basic config file * Add pre-commit to requirements.txt * Small tweaks and use stable for black * Fix isort section in pre-commit-config file * Fix errors and EOF only for Python files
1 parent 0a42ae9 commit ae65f55

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
 

‎.pre-commit-config.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.2.0
4+
hooks:
5+
- id: check-executables-have-shebangs
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
types: [python]
9+
- id: trailing-whitespace
10+
exclude: |
11+
(?x)^(
12+
data_structures/heap/binomial_heap.py
13+
)$
14+
- id: requirements-txt-fixer
15+
- repo: https://github.com/psf/black
16+
rev: stable
17+
hooks:
18+
- id: black
19+
- repo: https://github.com/PyCQA/isort
20+
rev: 5.5.3
21+
hooks:
22+
- id: isort
23+
args:
24+
- --profile=black
25+
- repo: https://gitlab.com/pycqa/flake8
26+
rev: 3.8.3
27+
hooks:
28+
- id: flake8
29+
args:
30+
- --ignore=E203,W503
31+
- --max-complexity=25
32+
- --max-line-length=88
33+
# FIXME: fix mypy errors and then uncomment this
34+
# - repo: https://github.com/pre-commit/mirrors-mypy
35+
# rev: v0.782
36+
# hooks:
37+
# - id: mypy
38+
# args:
39+
# - --ignore-missing-imports
40+
- repo: https://github.com/codespell-project/codespell
41+
rev: v1.17.1
42+
hooks:
43+
- id: codespell
44+
args:
45+
- --ignore-words-list=ans,fo,followings,hist,iff,secant,som,tim
46+
- --skip="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_22/p022_names.txt"
47+
- --quiet-level=2
48+
exclude: |
49+
(?x)^(
50+
other/dictionary.txt |
51+
other/words |
52+
project_euler/problem_22/p022_names.txt
53+
)$
54+
- repo: local
55+
hooks:
56+
- id: validate-filenames
57+
name: Validate filenames
58+
entry: ./scripts/validate_filenames.py
59+
language: script
60+
pass_filenames: false

‎requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ numpy
1010
opencv-python
1111
pandas
1212
pillow
13+
pre-commit
1314
pytest
1415
pytest-cov
1516
requests

0 commit comments

Comments
 (0)
Please sign in to comment.