Browse Source

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):
tags/v0.19.0
Wanderson Pinto dos Santos 6 months ago
parent
commit
4e8fd73a20
No account linked to committer's email address
8 changed files with 33 additions and 7 deletions
  1. 19
    0
      .pre-commit-config.yaml
  2. 2
    1
      README.md
  3. 2
    1
      README_id.md
  4. 2
    1
      README_ja.md
  5. 2
    1
      README_ko.md
  6. 2
    1
      README_pt_br.md
  7. 2
    1
      README_tzh.md
  8. 2
    1
      README_zh.md

+ 19
- 0
.pre-commit-config.yaml View File

@@ -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

+ 2
- 1
README.md View File

@@ -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:

+ 2
- 1
README_id.md View File

@@ -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:

+ 2
- 1
README_ja.md View File

@@ -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)を起動する:

+ 2
- 1
README_ko.md View File

@@ -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)를 시작합니다:

+ 2
- 1
README_pt_br.md View File

@@ -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:

+ 2
- 1
README_tzh.md View File

@@ -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):

+ 2
- 1
README_zh.md View File

@@ -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):

Loading…
Cancel
Save