Skip to content

Commit 58302cf

Browse files
committed
Add pre-commit hooks and config
1 parent 7207d49 commit 58302cf

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Pre-Commit
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 2
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
- name: Set up python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.13
24+
- name: Runs pre-commit
25+
run: |
26+
pip install pre-commit
27+
pre-commit run -a

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
- id: check-toml
8+
- id: debug-statements
9+
- id: destroyed-symlinks
10+
- id: detect-private-key
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
# Ruff version.
13+
rev: v0.13.0
14+
hooks:
15+
# Run the linter.
16+
- id: ruff-check
17+
# Run the formatter.
18+
- id: ruff-format
19+
- repo: https://github.com/pycqa/isort
20+
rev: 6.0.1
21+
hooks:
22+
- id: isort

0 commit comments

Comments
 (0)