Skip to content

Commit 4f6f6a8

Browse files
committed
Add YAML Formatting
1 parent 935ddc7 commit 4f6f6a8

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

.pre-commit-config.yaml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
1+
---
12
repos:
23
# ===============================================
34
# Pre-commit standard hooks (general file cleanup)
45
# ===============================================
56
- repo: https://github.com/pre-commit/pre-commit-hooks
67
rev: v4.6.0
78
hooks:
8-
- id: trailing-whitespace # Removes extra whitespace at the end of lines
9-
- id: end-of-file-fixer # Ensures files end with a newline
10-
- id: check-yaml # Checks YAML file syntax
11-
- id: check-toml # Checks TOML file syntax (e.g., pyproject.toml)
12-
- id: check-added-large-files # Prevents committing large files
13-
args: ['--maxkb=500'] # Example: Limit to 500KB
14-
- id: check-merge-conflict # Checks for merge conflict strings
15-
- id: detect-private-key # Detects accidental private key commits
9+
- id: trailing-whitespace # Removes extra whitespace at the end of lines
10+
- id: end-of-file-fixer # Ensures files end with a newline
11+
- id: check-yaml # Checks YAML file syntax (before formatting)
12+
- id: check-toml # Checks TOML file syntax (before formatting)
13+
- id: check-added-large-files # Prevents committing large files
14+
args: [--maxkb=500] # Example: Limit to 500KB
15+
- id: check-merge-conflict # Checks for merge conflict strings
16+
- id: detect-private-key # Detects accidental private key commits
1617

18+
# Formatter and linter for TOML files
1719
- repo: https://github.com/ComPWA/taplo-pre-commit
1820
rev: v0.9.3
1921
hooks:
2022
- id: taplo-format
2123
- id: taplo-lint
2224

25+
# YAML files
26+
- repo: https://github.com/lyz-code/yamlfix
27+
rev: 1.16.1
28+
hooks:
29+
- id: yamlfix
30+
2331
# ===============================================
2432
# Python Hooks
2533
# ===============================================
2634
# no_implicit_optional for ensuring explicit Optional types
2735
- repo: https://github.com/hauntsaninja/no_implicit_optional
28-
rev: "1.4"
36+
rev: '1.4'
2937
hooks:
3038
- id: no_implicit_optional
31-
args: ["--use-union-or"]
39+
args: [--use-union-or]
3240

3341
# Pyupgrade for upgrading Python syntax to newer versions
3442
- repo: https://github.com/asottile/pyupgrade
3543
rev: v3.20.0
3644
hooks:
3745
- id: pyupgrade
38-
args: ["--py310-plus"] # Target Python 3.10+ syntax, matching project's target
46+
args: [--py310-plus] # Target Python 3.10+ syntax, matching project's target
3947

4048
# Autoflake for removing unused imports and variables
4149
- repo: https://github.com/pycqa/autoflake
4250
rev: v2.3.1
4351
hooks:
4452
- id: autoflake
45-
args: ["--in-place", "--remove-all-unused-imports"]
53+
args: [--in-place, --remove-all-unused-imports]
4654

4755
# Ruff for linting and formatting
4856
- repo: https://github.com/astral-sh/ruff-pre-commit
4957
rev: v0.12.0
5058
hooks:
51-
- id: ruff # Linter: applies auto-fixable linting rules
52-
args: [ "--fix", "--exit-zero" ] # Apply fixes, and exit with 0 even if files were modified
53-
- id: ruff-format # Formatter: similar to Black, handles consistent code style
54-
args: [] # Check formatting, but do not auto-fix during commit; fail if not formatted
59+
- id: ruff # Linter: applies auto-fixable linting rules
60+
args: [--fix, --exit-zero] # Apply fixes, and exit with 0 even if files were modified
61+
- id: ruff-format # Formatter: similar to Black, handles consistent code style
62+
args: [] # Check formatting, but do not auto-fix during commit; fail if not formatted

0 commit comments

Comments
 (0)