From 930164dc389f9c39dd0ad9336eeb60f6cbdc46dc Mon Sep 17 00:00:00 2001
From: Matt Jaquiery <matt.jaquiery@dtc.ox.ac.uk>
Date: Tue, 8 Oct 2024 13:01:04 +0100
Subject: [PATCH] feat: add pre-commit hooks

Added `ruff` linting and some default warnings and fixes
---
 .pre-commit-config.yaml | 19 +++++++++++++++++++
 requirements.txt        |  2 ++
 2 files changed, 21 insertions(+)
 create mode 100644 .pre-commit-config.yaml

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..35e0566
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,19 @@
+# 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: v3.2.0
+  hooks:
+  -   id: trailing-whitespace
+  -   id: end-of-file-fixer
+  -   id: check-yaml
+  -   id: check-added-large-files
+- repo: https://github.com/astral-sh/ruff-pre-commit
+  # Ruff version.
+  rev: v0.6.9
+  hooks:
+    # Run the linter.
+    - id: ruff
+      args: [ --fix ]
+    # Run the formatter.
+    - id: ruff-format
diff --git a/requirements.txt b/requirements.txt
index 549fb47..d47cd1f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,6 +7,8 @@ holoviews==1.18.3
 matplotlib==3.9.0
 datashader==0.16.1
 
+pre-commit==4.0.0
+
 # Filetype readers
 galvani == 0.4.1
 maya==0.6.1