forked from pytorch/torchtitan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
117 lines (107 loc) · 3.48 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
117 lines (107 loc) · 3.48 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
exclude: 'build'
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 6306a48f7dae5861702d573c9c247e4e9498e867
hooks:
- id: trailing-whitespace
- id: check-ast
- id: check-merge-conflict
- id: no-commit-to-branch
args: ['--branch=main']
- id: check-added-large-files
args: ['--maxkb=500']
- id: end-of-file-fixer
exclude: '^(.*\.svg)$'
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: insert-license
files: \.py$
args:
- --license-filepath
- assets/license_header.txt
- repo: https://github.com/pycqa/flake8
rev: 34cbf8ef3950f43d09b85e2e45c15ae5717dc37b
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear == 22.4.25
- pep8-naming == 0.12.1
- torchfix
- flake8-pep585
- flake8-new-union-types == 0.4.1
args: ['--config=.flake8']
- repo: https://github.com/omnilib/ufmt
rev: v2.3.0
hooks:
- id: ufmt
additional_dependencies:
- black == 22.12.0
- usort == 1.0.5
- repo: https://github.com/jsh9/pydoclint
rev: d88180a8632bb1602a4d81344085cf320f288c5a
hooks:
- id: pydoclint
args: [--config=pyproject.toml]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell --toml pyproject.toml
language: python
types: [text]
additional_dependencies:
- tomli
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 0.45.1
hooks:
- id: pyrefly-check
name: Pyrefly (type checking)
pass_filenames: false
language: system
args: ["--remove-unused-ignores", "--summarize-errors"]
- repo: local
hooks:
# Check hyperlinks and external links
- id: lychee-link-checker
name: lychee-link-checker
language: system
entry: |
/bin/bash -c '
mkdir -p /tmp/lychee 2>/dev/null
SENTINEL_DIR="/tmp/lychee/lychee_lock_${PPID}"
if ! command -v lychee >/dev/null 2>&1; then
# mkdir is atomic; only one process will succeed in creating it
if mkdir "$SENTINEL_DIR" 2>/dev/null; then
{
echo "--------------------------------------------------------"
echo "Warning: Lychee (link checker) not found. Skipping ... "
echo ""
echo "To enable local link checking, install Lychee:"
echo " - MacOS: brew install lychee"
echo " - Linux/Windows: https://github.com/lycheeverse/lychee"
echo "--------------------------------------------------------"
} > /dev/tty 2>/dev/null || true
fi
exit 0
fi
lychee "$@"
' --
args:
- "--quiet"
- "--no-progress"
- "--cache"
- "--exclude-path=(^|/)\\.[^/]+/"
- "--root-dir=."
- "--accept=100..399,400,401,402,403,405..999" # Fail only on 404
- "--exclude=http://localhost:.*"
- "--exclude=http://127.0.0.1:.*"
- "--exclude=tcp://localhost:.*"
- "--max-retries=5"
- "--retry-wait-time=10"
- "--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
types_or: [markdown, python]