Skip to content

Commit 4e8fd73

Browse files
authored
chore: adds pre-commit (#7242)
### What problem does this PR solve? Sometimes after we commit the code and open the PR the CI pipeline fails in Ruff checks. Including a pre-commit we can identify this problem early and avoid time loss. ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [X] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
1 parent 19931cd commit 4e8fd73

8 files changed

+33
-7
lines changed

.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: check-yaml
6+
- id: check-json
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- id: check-case-conflict
10+
- id: check-merge-conflict
11+
- id: mixed-line-ending
12+
- id: check-symlinks
13+
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.11.6
16+
hooks:
17+
- id: ruff
18+
args: [ --fix ]
19+
- id: ruff-format

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
296296
1. Install uv, or skip this step if it is already installed:
297297
298298
```bash
299-
pipx install uv
299+
pipx install uv pre-commit
300300
```
301301
302302
2. Clone the source code and install Python dependencies:
@@ -305,6 +305,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
305305
git clone https://github.com/infiniflow/ragflow.git
306306
cd ragflow/
307307
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
308+
pre-commit install
308309
```
309310
310311
3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:

README_id.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
262262
1. Instal uv, atau lewati langkah ini jika sudah terinstal:
263263

264264
```bash
265-
pipx install uv
265+
pipx install uv pre-commit
266266
```
267267

268268
2. Clone kode sumber dan instal dependensi Python:
@@ -271,6 +271,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
271271
git clone https://github.com/infiniflow/ragflow.git
272272
cd ragflow/
273273
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
274+
pre-commit install
274275
```
275276

276277
3. Jalankan aplikasi yang diperlukan (MinIO, Elasticsearch, Redis, dan MySQL) menggunakan Docker Compose:

README_ja.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
258258
1. uv をインストールする。すでにインストールされている場合は、このステップをスキップしてください:
259259

260260
```bash
261-
pipx install uv
261+
pipx install uv pre-commit
262262
```
263263

264264
2. ソースコードをクローンし、Python の依存関係をインストールする:
@@ -267,6 +267,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
267267
git clone https://github.com/infiniflow/ragflow.git
268268
cd ragflow/
269269
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
270+
pre-commit install
270271
```
271272

272273
3. Docker Compose を使用して依存サービス(MinIO、Elasticsearch、Redis、MySQL)を起動する:

README_ko.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
257257
1. uv를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다:
258258

259259
```bash
260-
pipx install uv
260+
pipx install uv pre-commit
261261
```
262262

263263
2. 소스 코드를 클론하고 Python 의존성을 설치합니다:
@@ -266,6 +266,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
266266
git clone https://github.com/infiniflow/ragflow.git
267267
cd ragflow/
268268
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
269+
pre-commit install
269270
```
270271

271272
3. Docker Compose를 사용하여 의존 서비스(MinIO, Elasticsearch, Redis 및 MySQL)를 시작합니다:

README_pt_br.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
281281
1. Instale o `uv`, ou pule esta etapa se ele já estiver instalado:
282282
283283
```bash
284-
pipx install uv
284+
pipx install uv pre-commit
285285
```
286286
287287
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
290290
git clone https://github.com/infiniflow/ragflow.git
291291
cd ragflow/
292292
uv sync --python 3.10 --all-extras # instala os módulos Python dependentes do RAGFlow
293+
pre-commit install
293294
```
294295
295296
3. Inicie os serviços dependentes (MinIO, Elasticsearch, Redis e MySQL) usando Docker Compose:

README_tzh.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
269269
1. 安裝 uv。如已安裝,可跳過此步驟:
270270

271271
```bash
272-
pipx install uv
272+
pipx install uv pre-commit
273273
export UV_INDEX=https://mirrors.aliyun.com/pypi/simple
274274
```
275275

@@ -279,6 +279,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
279279
git clone https://github.com/infiniflow/ragflow.git
280280
cd ragflow/
281281
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
282+
pre-commit install
282283
```
283284

284285
3. 透過 Docker Compose 啟動依賴的服務(MinIO, Elasticsearch, Redis, and MySQL):

README_zh.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
270270
1. 安装 uv。如已经安装,可跳过本步骤:
271271

272272
```bash
273-
pipx install uv
273+
pipx install uv pre-commit
274274
export UV_INDEX=https://mirrors.aliyun.com/pypi/simple
275275
```
276276

@@ -280,6 +280,7 @@ docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t i
280280
git clone https://github.com/infiniflow/ragflow.git
281281
cd ragflow/
282282
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
283+
pre-commit install
283284
```
284285

285286
3. 通过 Docker Compose 启动依赖的服务(MinIO, Elasticsearch, Redis, and MySQL):

0 commit comments

Comments
 (0)