Skip to content

Commit 7dffae2

Browse files
committed
Add pre-commit.
1 parent afe87a3 commit 7dffae2

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
files: ^(src|tests)/
2+
exclude: ^tests/(input|output)/
3+
4+
repos:
5+
# General file quality checks
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v5.0.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-added-large-files
12+
args: [--maxkb=1000] # Prevent files larger than 1MB
13+
- id: check-merge-conflict
14+
15+
# Python formatting and linting
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.8.4
18+
hooks:
19+
# Run the formatter
20+
- id: ruff-format
21+
# Run the linter (optional - remove if too strict)
22+
- id: ruff
23+
args: [--fix, --exit-zero] # Auto-fix but don't block commits

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,25 @@ Once finished, you can test the installation by running:
137137
138138
import BioSimSpace as BSS
139139
140+
Development
141+
-----------
142+
143+
Pre-commit hooks are used to ensure consistent code formatting and linting.
144+
To set up pre-commit in your development environment:
145+
146+
.. code-block:: bash
147+
148+
pixi shell -e dev
149+
pre-commit install
150+
151+
This will run `ruff <https://docs.astral.sh/ruff/>`__ formatting and linting
152+
checks automatically on each commit. To run the checks manually against all
153+
files:
154+
155+
.. code-block:: bash
156+
157+
pre-commit run --all-files
158+
140159
Developers
141160
----------
142161

0 commit comments

Comments
 (0)