Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

chore: adds pre-commit (#7242)

Wanderson Pinto dos Santos4e8fd73a20e6
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000000..8a8cb2d57b
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,19 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ - id: check-yaml
+ - id: check-json
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - id: check-case-conflict
+ - id: check-merge-conflict
+ - id: mixed-line-ending
+ - id: check-symlinks
+
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.11.6
+ hooks:
+ - id: ruff
+ args: [ --fix ]
+ - id: ruff-format
diff --git a/README.md b/README.md
index f8636c9c06..bc25138785 100644
--- a/README.md
+++ b/README.md
@@ -296,7 +296,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
1. Install uv, or skip this step if it is already installed:
```bash
- pipx install uv
+ pipx install uv pre-commit
```
2. Clone the source code and install Python dependencies:
@@ -305,6 +305,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
diff --git a/README_id.md b/README_id.md
index 7734d59c91..65aaf01ef6 100644
--- a/README_id.md
+++ b/README_id.md
@@ -262,7 +262,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
1. Instal uv, atau lewati langkah ini jika sudah terinstal:
```bash
- pipx install uv
+ pipx install uv pre-commit
```
2. Clone kode sumber dan instal dependensi Python:
@@ -271,6 +271,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. Jalankan aplikasi yang diperlukan (MinIO, Elasticsearch, Redis, dan MySQL) menggunakan Docker Compose:
diff --git a/README_ja.md b/README_ja.md
index 0cb3447b7e..28b8b3a47e 100644
--- a/README_ja.md
+++ b/README_ja.md
@@ -258,7 +258,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
1. uv をインストールする。すでにインストールされている場合は、このステップをスキップしてください:
```bash
- pipx install uv
+ pipx install uv pre-commit
```
2. ソースコードをクローンし、Python の依存関係をインストールする:
@@ -267,6 +267,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. Docker Compose を使用して依存サービス(MinIO、Elasticsearch、Redis、MySQL)を起動する:
diff --git a/README_ko.md b/README_ko.md
index 440350b1af..f501199dd6 100644
--- a/README_ko.md
+++ b/README_ko.md
@@ -257,7 +257,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
1. uv를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다:
```bash
- pipx install uv
+ pipx install uv pre-commit
```
2. 소스 코드를 클론하고 Python 의존성을 설치합니다:
@@ -266,6 +266,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. Docker Compose를 사용하여 의존 서비스(MinIO, Elasticsearch, Redis 및 MySQL)를 시작합니다:
diff --git a/README_pt_br.md b/README_pt_br.md
index 446d745785..7c72a5980d 100644
--- a/README_pt_br.md
+++ b/README_pt_br.md
@@ -281,7 +281,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
1. Instale o `uv`, ou pule esta etapa se ele já estiver instalado:
```bash
- pipx install uv
+ pipx install uv pre-commit
```
2. Clone o código-fonte e instale as dependências Python:
@@ -290,6 +290,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # instala os módulos Python dependentes do RAGFlow
+ pre-commit install
```
3. Inicie os serviços dependentes (MinIO, Elasticsearch, Redis e MySQL) usando Docker Compose:
diff --git a/README_tzh.md b/README_tzh.md
index 878c11771f..2daa2c8f1e 100644
--- a/README_tzh.md
+++ b/README_tzh.md
@@ -269,7 +269,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
1. 安裝 uv。如已安裝,可跳過此步驟:
```bash
- pipx install uv
+ pipx install uv pre-commit
export UV_INDEX=https://mirrors.aliyun.com/pypi/simple
```
@@ -279,6 +279,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. 透過 Docker Compose 啟動依賴的服務(MinIO, Elasticsearch, Redis, and MySQL):
diff --git a/README_zh.md b/README_zh.md
index 03a416a2f1..6535042ac1 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -270,7 +270,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
1. 安装 uv。如已经安装,可跳过本步骤:
```bash
- pipx install uv
+ pipx install uv pre-commit
export UV_INDEX=https://mirrors.aliyun.com/pypi/simple
```
@@ -280,6 +280,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
+ pre-commit install
```
3. 通过 Docker Compose 启动依赖的服务(MinIO, Elasticsearch, Redis, and MySQL):