-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
51 lines (46 loc) · 2.25 KB
/
.pre-commit-config.yaml
File metadata and controls
51 lines (46 loc) · 2.25 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
# .pre-commit-config.yaml
# Global settings (optional, but good practice)
# default_stages: [commit] # Run hooks on commit (default)
# default_language_version:
# python: python3.11 # Or your project's Python version
# Define a list of repositories and the hooks to use from them
repos:
# Standard hooks for general file linting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the latest stable version
hooks:
- id: check-yaml # Checks yaml files for parseable syntax.
exclude: ^mkdocs\.yml$ # Exclude mkdocs.yml due to MkDocs-specific YAML tags
- id: check-toml # Checks toml files for parseable syntax.
- id: end-of-file-fixer # Ensures files end with a newline.
- id: trailing-whitespace # Trims trailing whitespace.
# - id: check-docstring-first # Checks that modules and classes have docstrings. (Can be noisy initially)
- id: check-added-large-files # Prevents committing large files.
- id: check-merge-conflict # Checks for files that contain merge conflict strings.
- id: debug-statements # Checks for debugger imports and calls.
# Ruff: Super-fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version. Must be maintained from time to time.
rev: v0.1.9 # Use a recent version compatible with your ruff settings
hooks:
- id: ruff # Runs ruff --fix
args: [--fix, --exit-non-zero-on-fix] # Apply fixes and exit if fixes were made
- id: ruff-format # Runs ruff format
# TODO: Re-enable MyPy after resolving module path conflicts
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.8.0 # Or latest
# hooks:
# - id: mypy
# args: ["codebrief"]
# pass_filenames: false
# # Run from src directory to avoid module path conflicts
# language: system
# entry: bash -c 'cd src && mypy codebrief'
# Bandit: Security linter for Python
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6 # Use the latest stable version
hooks:
- id: bandit
args: ["-c", "pyproject.toml"] # Tell bandit to use config from pyproject.toml
# Exclude test files if they contain intentional "vulnerabilities" for testing purposes
# exclude: ^tests/