-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
40 lines (39 loc) · 1.97 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
40 lines (39 loc) · 1.97 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
# .pre-commit-config.yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the latest stable version
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-ast # Checks for syntax errors in Python files
- id: check-docstring-first # Ensures docstrings are at the top of modules/classes/functions
# Removed Black in favor of Ruff's formatter for a unified toolchain.
# Ruff's formatter (ruff-format) is generally compatible with Black's style
# and allows for a single tool to handle both linting and formatting.
# - repo: https://github.com/psf/black # REMOVED: Commented-out Black config
# rev: 23.11.0 # Use the latest stable version
# hooks:
# - id: black
# language_version: python3.11 # Specify your Python version, adjust if needed
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.0 # Use a newer stable version (check PyPI for latest)
hooks:
- id: ruff # Runs linting checks (and auto-fixes)
args: ["--fix", "--exit-non-zero-on-fix"] # Automatically fix linting errors and fail if unfixed
- id: ruff-format # Enforces formatting via Ruff (like Black)
args: ["--check"] # Fail if code is not formatted (prevents unformatted commits)
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
# Bandit automatically receives staged files as arguments.
# We remove '-r .' to prevent conflicts with pre-commit's file passing mechanism.
args: ["-c", "pyproject.toml", "--severity-level", "high", "--confidence-level", "high"]
additional_dependencies: [pbr] # ADD THIS
# REMOVED: Commented-out section for other pre-commit hooks
# Add other pre-commit hooks as needed, for example:
# - repo: https://github.com/psf/black