chore: fix pre commit format and pipeline issue (#1144)

This commit is contained in:
Wendong-Fan 2026-02-04 00:06:29 +00:00 committed by GitHub
parent 2256497dff
commit 893f51fc82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
970 changed files with 11235 additions and 9533 deletions

View file

@ -9,7 +9,8 @@ repos:
rev: v6.0.0
hooks:
- id: no-commit-to-branch
name: No commits to master
name: No commits to main
args: [--branch, main]
- id: end-of-file-fixer
name: End-of-file fixer
- name: mixed-line-ending
@ -17,6 +18,7 @@ repos:
args: [--fix, lf]
- id: trailing-whitespace
name: Remove trailing whitespaces
exclude: '\.md$'
- id: check-toml
name: Check toml
- id: check-yaml
@ -27,54 +29,27 @@ repos:
hooks:
- id: yamllint
name: Lint yaml
args: [-d, '{extends: default, rules: {line-length: disable, document-start: disable, truthy: {level: error}, braces: {max-spaces-inside: 1}}}']
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
hooks:
- id: pyupgrade
name: Upgrade Python syntax
args: [--py38-plus]
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
name: Remove unused imports and variables
args: [
--remove-all-unused-imports,
--remove-unused-variables,
--remove-duplicate-keys,
--ignore-init-module-imports,
--in-place,
]
- repo: https://github.com/google/yapf
rev: v0.43.0
hooks:
- id: yapf
name: Format code
additional_dependencies: [toml]
- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
- id: isort
name: Sort imports
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
name: Check PEP8
additional_dependencies: [Flake8-pyproject]
args: [-d, '{extends: default, rules: {line-length: disable, document-start: disable, truthy: disable, braces: disable, brackets: disable, indentation: disable, comments: disable, comments-indentation: disable}}']
# Ruff replaces: yapf, flake8, autoflake, pyupgrade, isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.3
hooks:
- id: ruff
name: Ruff formatting
args: [--fix, --exit-non-zero-on-fix]
name: Ruff lint (auto-fix)
args: [--fix]
- id: ruff-format
name: Ruff format
# Security scanning
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
hooks:
- id: bandit
name: Bandit security check
args: ["-c", "backend/pyproject.toml", "-r", "backend/"]
pass_filenames: false
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22