dystomachina commited on
Commit
e3fd3fb
·
1 Parent(s): ff73b92

feat: adjust commit hooks

Browse files
Files changed (3) hide show
  1. .pre-commit-config.yaml +12 -1
  2. .pre-push-config.yaml +37 -0
  3. Makefile +3 -4
.pre-commit-config.yaml CHANGED
@@ -5,33 +5,44 @@ repos:
5
  - id: ruff
6
  args: [--fix]
7
  files: ^(src|tests)/
 
8
  - id: ruff-format
9
  files: ^(src|tests)/
10
  types_or: [python, pyi]
 
11
 
12
  - repo: https://github.com/pre-commit/pre-commit-hooks
13
  rev: v4.5.0
14
  hooks:
15
  - id: trailing-whitespace
 
16
  - id: end-of-file-fixer
 
17
  - id: check-yaml
 
18
  - id: check-added-large-files
 
19
  - id: check-toml
 
20
  - id: check-json
 
21
  - id: debug-statements
 
22
  - id: check-merge-conflict
 
23
 
24
  - repo: https://github.com/python-jsonschema/check-jsonschema
25
  rev: 0.28.0
26
  hooks:
27
  - id: check-github-workflows
28
  args: ["--verbose"]
 
29
 
30
  - repo: https://github.com/python-poetry/poetry
31
  rev: 1.8.2
32
  hooks:
33
  - id: poetry-check
34
- stages: [pre-commit]
35
  files: ^pyproject.toml$
36
 
37
  # Run local hooks using Poetry
 
5
  - id: ruff
6
  args: [--fix]
7
  files: ^(src|tests)/
8
+ stages: [pre-commit]
9
  - id: ruff-format
10
  files: ^(src|tests)/
11
  types_or: [python, pyi]
12
+ stages: [pre-push]
13
 
14
  - repo: https://github.com/pre-commit/pre-commit-hooks
15
  rev: v4.5.0
16
  hooks:
17
  - id: trailing-whitespace
18
+ stages: [pre-commit]
19
  - id: end-of-file-fixer
20
+ stages: [pre-commit]
21
  - id: check-yaml
22
+ stages: [pre-push]
23
  - id: check-added-large-files
24
+ stages: [pre-push]
25
  - id: check-toml
26
+ stages: [pre-push]
27
  - id: check-json
28
+ stages: [pre-push]
29
  - id: debug-statements
30
+ stages: [pre-commit]
31
  - id: check-merge-conflict
32
+ stages: [pre-commit]
33
 
34
  - repo: https://github.com/python-jsonschema/check-jsonschema
35
  rev: 0.28.0
36
  hooks:
37
  - id: check-github-workflows
38
  args: ["--verbose"]
39
+ stages: [pre-push]
40
 
41
  - repo: https://github.com/python-poetry/poetry
42
  rev: 1.8.2
43
  hooks:
44
  - id: poetry-check
45
+ stages: [pre-push]
46
  files: ^pyproject.toml$
47
 
48
  # Run local hooks using Poetry
.pre-push-config.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.11.4
4
+ hooks:
5
+ - id: ruff-format
6
+ files: ^(src|tests)/
7
+ types_or: [python, pyi]
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v4.5.0
11
+ hooks:
12
+ - id: check-yaml
13
+ - id: check-added-large-files
14
+ - id: check-toml
15
+ - id: check-json
16
+
17
+ - repo: https://github.com/python-jsonschema/check-jsonschema
18
+ rev: 0.28.0
19
+ hooks:
20
+ - id: check-github-workflows
21
+ args: ["--verbose"]
22
+
23
+ - repo: https://github.com/python-poetry/poetry
24
+ rev: 1.8.2
25
+ hooks:
26
+ - id: poetry-check
27
+ files: ^pyproject.toml$
28
+
29
+ # Run tests only on push
30
+ - repo: local
31
+ hooks:
32
+ - id: pytest-check
33
+ name: pytest-check
34
+ entry: poetry run pytest
35
+ language: system
36
+ pass_filenames: false
37
+ always_run: true
Makefile CHANGED
@@ -76,16 +76,15 @@ install:
76
  # Install git hooks
77
  .PHONY: hooks
78
  hooks:
79
- @echo "Installing git hooks with pre-commit..."
80
  @if ! command -v $(POETRY) &> /dev/null; then \
81
  echo "Poetry not found. Please run 'make env' first."; \
82
  exit 1; \
83
  fi
84
- @$(POETRY) run pre-commit install
 
85
  @echo "Git hooks installed successfully!"
86
 
87
-
88
-
89
  # Clean up generated files
90
  .PHONY: clean
91
  clean:
 
76
  # Install git hooks
77
  .PHONY: hooks
78
  hooks:
79
+ @echo "Installing git hooks..."
80
  @if ! command -v $(POETRY) &> /dev/null; then \
81
  echo "Poetry not found. Please run 'make env' first."; \
82
  exit 1; \
83
  fi
84
+ @$(POETRY) run pre-commit install -c .pre-commit-config.yaml --hook-type pre-commit
85
+ @$(POETRY) run pre-commit install -c .pre-push-config.yaml --hook-type pre-push
86
  @echo "Git hooks installed successfully!"
87
 
 
 
88
  # Clean up generated files
89
  .PHONY: clean
90
  clean: