-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
157 lines (141 loc) · 4.24 KB
/
.pre-commit-config.yaml
File metadata and controls
157 lines (141 loc) · 4.24 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Pre-commit hooks for Python projects
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.10
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# Prevent giant files from being committed
- id: check-added-large-files
args: [--maxkb=1000]
# Check for files that would conflict in case-insensitive filesystems
- id: check-case-conflict
# Check for merge conflicts
- id: check-merge-conflict
# Check for debugger imports and py37+ breakpoint()
- id: debug-statements
# Check JSON files are valid
- id: check-json
# Check TOML files are valid
- id: check-toml
# Check YAML files are valid
- id: check-yaml
args: [--unsafe] # Allow custom YAML tags
# Ensure files end with a newline
- id: end-of-file-fixer
# Remove trailing whitespace
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
# Fix mixed line endings
- id: mixed-line-ending
args: [--fix=lf]
# Check docstrings are valid Python
- id: check-docstring-first
# Check for symlinks that point to nothing
- id: check-symlinks
# Detect private keys
- id: detect-private-key
# Ruff - Fast Python linter and formatter (replaces Black, isort, flake8, pylint)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
# Type checking with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies:
- types-PyYAML
- types-requests
args: [--ignore-missing-imports, --warn-unused-configs]
# Only run on serverlessworkflow package, not tests
files: ^serverlessworkflow/
# Security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: [-c, pyproject.toml]
additional_dependencies: ['bandit[toml]']
# Skip tests directory
exclude: ^tests/
# # Check for common security issues
# - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
# rev: v1.3.3
# hooks:
# - id: python-safety-dependencies-check
# files: pyproject.toml
# Markdown formatting
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm # GitHub Flavored Markdown
- mdformat-black # Format code blocks with black style
args: [--wrap, '100']
# Check for spelling errors
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: [--ignore-words-list=crate]
exclude: ^(poetry.lock|package-lock.json|\.git/|\.pytest_cache/|\.mypy_cache/)
# Validate GitHub Actions workflows
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.4
hooks:
- id: check-github-workflows
- id: check-dependabot
# YAML formatting
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
exclude: ^(\.github/|examples/) # Exclude workflow files and examples
# pyproject.toml formatting
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
hooks:
- id: pyproject-fmt
# Check for outdated Python syntax
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py310-plus]
# Check requirements files
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
# Conventional commits
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.0.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [--force-scope]
# CI configuration
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false