-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
67 lines (60 loc) · 2.12 KB
/
.pre-commit-config.yaml
File metadata and controls
67 lines (60 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
exclude: ^docs/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=92160']
# - repo: https://github.com/psf/black
# rev: 24.10.0
# hooks:
# - id: black
# name: Format Python code with Black
# language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
name: Static type checking with MyPy
exclude: ^bioneuralnet/network/pysmccnet/
args: [
--ignore-missing-imports,
--follow-imports=silent,
]
- repo: local
hooks:
- id: remove-pyc-and-pycache
name: Remove .pyc files and __pycache__ directories
entry: bash -c 'find . \( -path "./.enviroment" -o -path "./.testing" -o -path "./.venv" -o -path "./docs" -o -path "./node_modules" \) -prune -o -type f -name "*.pyc" -exec rm -f {} + -o -type d -name "__pycache__" -exec rm -rf {} +'
pass_filenames: false
language: system
stages: [pre-commit]
- id: clean-coverage-files
name: Remove stale .coverage files
entry: bash -c "find . -name '.coverage*' -exec rm -f {} + 2>/dev/null || true"
language: system
stages: [pre-commit]
- id: check-forbidden-files
name: Prevent adding forbidden file types except in allowed directory
entry: |
bash -c '
FILES="$(git diff --cached --name-only)"
if echo "$FILES" | grep -E "\.RData$"; then
echo "Forbidden file types detected (RData)!"
exit 1
fi
if echo "$FILES" | grep -E "\.csv$" | grep -vE "^bioneuralnet/datasets/(example|brca|monet)/"; then
echo "Forbidden CSV files detected (outside allowed folders)!"
exit 1
fi
'
language: system
stages: [pre-commit]
- id: run-tests
name: Run Tests with Pytest
entry: bash -c "pytest tests"
language: system
types: [python]