forked from networkx/networkx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
87 lines (79 loc) · 2.94 KB
/
.pre-commit-config.yaml
File metadata and controls
87 lines (79 loc) · 2.94 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
83
84
85
86
87
# Install pre-commit hooks via
# pre-commit install
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
# Sanity checks
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-merge-conflict
# Checks based on file type
- id: check-ast
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
# Detect mistakes
- id: debug-statements
- id: detect-private-key
- id: forbid-submodules
# Automatic fixes
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
exclude_types: [svg, xml]
exclude: test_p2g.py
- repo: https://github.com/rbubley/mirrors-prettier
rev: 787fb9f542b140ba0b2aced38e6a3e68021647a3 # frozen: v3.5.3
hooks:
- id: prettier
files: \.(html|md|toml|yml|yaml)
args: [--prose-wrap=preserve]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: f0fe93c067104b76ffb58852abe79673a8429bd1 # frozen: v0.11.8
hooks:
- id: ruff
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
- id: ruff-format
- repo: local
hooks:
- id: generate_requirements.py
name: generate_requirements.py
language: system
entry: python tools/generate_requirements.py
files: "pyproject.toml|requirements/.*\\.txt|tools/generate_requirements.py"
- repo: local
hooks:
- id: check-import-conventions
name: Check import conventions; see CONTRIBUTING.rst#guidelines
language: pygrep
entry: "^ *import (networkx(,|$| (?!as nx))|numpy(?! as np)|scipy(?! as sp)|pandas(?! as pd)|matplotlib(,|$)|matplotlib.pyplot(?! as plt)|matplotlib (?!as mpl))"
# The hooks below do not run automatically (may be too slow, bothersome, or low value).
# They can be run manually such as before releasing a new version or annually. To run:
#
# $ pre-commit run --all-files --hook-stage manual
#
# Automatically remove unused imports (but not as aggressively as ruff rule F401)
- repo: https://github.com/PyCQA/autoflake
rev: 0544741e2b4a22b472d9d93e37d4ea9153820bb1 # frozen: v2.3.1
hooks:
- id: autoflake
stages: [manual]
args: [--in-place]
# Automatically upgrade syntax for newer versions of Python (may do more than ruff)
- repo: https://github.com/asottile/pyupgrade
rev: ce40a160603ab0e7d9c627ae33d7ef3906e2d2b2 # frozen: v3.19.1
hooks:
- id: pyupgrade
stages: [manual]
args: [--py311-plus]
# Additional ruff rules that may be nice to check occasionally, but not require
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 73413df07b4ab0bf103ca1ae73c7cec5c0ace593 # frozen: v0.9.2
hooks:
- id: ruff
stages: [manual]
args: [--select=PERF]