-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
82 lines (75 loc) · 2.85 KB
/
.pre-commit-config.yaml
File metadata and controls
82 lines (75 loc) · 2.85 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# YAML formatting specifications: https://yaml.org/spec/1.2.2/
repos:
# Generate up-to-date Murfey route manifest
# NOTE: This will only work if Murfey is installed in the current Python environment
- repo: local
hooks:
- id: generate-route-manifest
name: Generating Murfey route manifest
entry: murfey.generate_route_manifest
language: system
# Only run if FastAPI router-related modules are changed
files: ^src/murfey/(instrument_server/.+\.py|server/(main|api/.+)\.py)$
pass_filenames: false
# Syntax validation and some basic sanity checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Released 2023-10-09
# rev input based on version tag format in repo (e.g. with or without 'v')
hooks:
- id: check-added-large-files
name: Checking for added large files
args: ["--maxkb=200"]
fail_fast: True
- id: check-case-conflict
name: Checking for name case conflicts
- id: check-merge-conflict
name: Checking for merge conflicts
- id: check-ast
name: Verifying Python file syntax
- id: check-json
name: Verifying JSON file syntax
- id: check-yaml
name: Verifying YAML file syntax
exclude: Helm/charts/.*?/templates/deployment\.yaml
args: [--allow-multiple-documents]
- id: check-toml
name: Verifying TOML file syntax
# Format the pyproject.toml file
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0 # Released 2024-01-22
hooks:
- id: pyproject-fmt
name: Formatting the pyproject.toml file
additional_dependencies: ["tox>=4.9"]
# Format and lint using Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.0
hooks:
- id: ruff
name: Running Ruff linter
args: ["--fix"]
- id: ruff-format
name: Running Ruff formatter
# Type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0 # Released 2024-03-09
hooks:
- id: mypy
name: Checking types in Python scripts using MyPy
files: '(src|tests)/.*\.py$' # RegEx string showing directories and files to check
# Single quote critical due to escape character '\' used in the search string
# (see YAML specifications - 7.3 Flow Scalar Styles)
additional_dependencies: [
# Install missing stub packages
types-requests,
types-xmltodict,
types-PyYAML,
]
# Use Prettier to format other files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0 # Released 2023-11-13 | Latest stable version
hooks:
- id: prettier
name: Formatting other file types according to Prettier
exclude: Helm/charts/.*?/templates/deployment\.yaml
# types_or: [css, html, json, yaml]