Skip to content

Commit fa18468

Browse files
Add pre-commit hooks and fix formatting
1 parent f1063ba commit fa18468

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- id: check-added-large-files
10+
11+
- repo: https://github.com/psf/black
12+
rev: 24.1.1
13+
hooks:
14+
- id: black
15+
language_version: python3.9
16+
17+
- repo: https://github.com/pycqa/isort
18+
rev: 5.13.2
19+
hooks:
20+
- id: isort
21+
args: ["--profile", "black"]
22+
23+
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
rev: v4.5.0
25+
hooks:
26+
- id: no-commit-to-branch
27+
args: [--branch, main]

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
.PHONY: install test lint format check-format check-imports clean
1+
.PHONY: install test lint format check-format check-imports clean setup-pre-commit
22

33
install:
44
pip install -e .
5-
pip install pytest pytest-cov black isort
5+
pip install pytest pytest-cov black isort pre-commit
6+
7+
setup-pre-commit:
8+
pre-commit install
69

710
test:
811
pytest tests/ --cov=anomaly_detection --cov-report=term-missing -v
@@ -32,4 +35,4 @@ clean:
3235
find . -type d -name ".pytest_cache" -exec rm -r {} +
3336
find . -type d -name ".coverage" -exec rm -r {} +
3437
find . -type d -name "htmlcov" -exec rm -r {} +
35-
find . -type f -name "coverage.xml" -delete
38+
find . -type f -name "coverage.xml" -delete

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ httpx>=0.24.0
66
isort>=5.9.3
77
numpy>=1.21.0
88
pandas>=1.3.0
9+
pre-commit>=3.6.0
910
python-dotenv>=0.19.0
1011
pytest>=6.2.5
1112
pytest-cov>=2.12.1
1213
scikit-learn>=0.24.2
13-
uvicorn>=0.15.0
14+
uvicorn>=0.15.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import find_packages, setup
22

33
setup(
44
name="anomaly_detection",
@@ -16,4 +16,4 @@
1616
"pytest-cov>=2.12.0",
1717
],
1818
python_requires=">=3.8",
19-
)
19+
)

0 commit comments

Comments
 (0)