41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
|
|
repos:
|
|||
|
|
# 1️⃣ 自定义 fullwidth-to-halfwidth 脚本
|
|||
|
|
- repo: local
|
|||
|
|
hooks:
|
|||
|
|
- id: fullwidth-to-halfwidth
|
|||
|
|
name: Convert fullwidth characters to halfwidth
|
|||
|
|
entry: python tools/fullwidth_to_halfwidth_converter.py
|
|||
|
|
language: system
|
|||
|
|
types: [python]
|
|||
|
|
verbose: true
|
|||
|
|
|
|||
|
|
# 3️⃣ autopep8 自动格式化
|
|||
|
|
- repo: https://github.com/pre-commit/mirrors-autopep8
|
|||
|
|
rev: v2.0.4
|
|||
|
|
hooks:
|
|||
|
|
- id: autopep8
|
|||
|
|
args:
|
|||
|
|
["--in-place", "--aggressive", "--aggressive", "--max-line-length=100"]
|
|||
|
|
|
|||
|
|
# 2️⃣ Ruff 检查 & 自动修复
|
|||
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|||
|
|
rev: v0.14.4
|
|||
|
|
hooks:
|
|||
|
|
- id: ruff
|
|||
|
|
# 忽略全角字符相关的警告,忽略行长度限制
|
|||
|
|
# args: ["--fix"]
|
|||
|
|
args: ["--fix", "--ignore=RUF001,RUF002,RUF003,RUF022", "--line-length=100"]
|
|||
|
|
|
|||
|
|
# 4️⃣ 常用 pre-commit hooks
|
|||
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|||
|
|
rev: v6.0.0
|
|||
|
|
hooks:
|
|||
|
|
- id: check-yaml
|
|||
|
|
- id: check-json
|
|||
|
|
- id: check-toml
|
|||
|
|
- id: check-merge-conflict
|
|||
|
|
- id: detect-private-key
|
|||
|
|
- id: end-of-file-fixer
|
|||
|
|
- id: trailing-whitespace
|
|||
|
|
- id: check-added-large-files
|