Ludek Matyska commited on
Commit
40c13b8
·
1 Parent(s): 17aca7c

feat: add pre-commit ruff

Browse files
Files changed (2) hide show
  1. .pre-commit-config.yaml +17 -0
  2. README.md +25 -0
.pre-commit-config.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ - id: check-merge-conflict
10
+ - id: debug-statements
11
+
12
+ - repo: https://github.com/astral-sh/ruff-pre-commit
13
+ rev: v0.8.4
14
+ hooks:
15
+ - id: ruff
16
+ args: [--fix]
17
+ - id: ruff-format
README.md CHANGED
@@ -11,3 +11,28 @@ tags: ["mcp-server-track"]
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
+
15
+ ## Code Quality: pre-commit & Ruff
16
+
17
+ This project uses [pre-commit](https://pre-commit.com/) and [ruff](https://docs.astral.sh/ruff/) to automatically check and format code before each commit.
18
+
19
+ ### Setup
20
+ 1. Create and activate the environment (if not already):
21
+ ```sh
22
+ uv venv mcp-qiskit-learn-env
23
+ source mcp-qiskit-learn-env/bin/activate
24
+ uv pip install -r requirements.txt
25
+ uv pip install pre-commit
26
+ ```
27
+ 2. Install the pre-commit hooks:
28
+ ```sh
29
+ pre-commit install
30
+ ```
31
+
32
+ ### Usage
33
+ - Hooks will run automatically on `git commit`.
34
+ - To manually check all files:
35
+ ```sh
36
+ pre-commit run --all-files
37
+ ```
38
+ - Ruff will auto-fix and format Python code according to the configuration in `.pre-commit-config.yaml`.