格式化和代码检查说明

This commit is contained in:
glide-the 2024-03-29 18:26:50 +08:00
parent 27f0f512a3
commit 6e9e31a32c

View File

@ -12,12 +12,33 @@ Install Poetry: [documentation on how to install it.](https://python-poetry.org/
#### 本地开发环境安装
- 选择主项目目录
```
```shell
cd chatchat
```
- 安装chatchat依赖(for running chatchat lint\tests):
```
```shell
poetry install --with lint,test
```
```
#### 格式化和代码检查
在提交PR之前,请在本地运行以下命令;CI系统也会进行检查。
##### 代码格式化
本项目使用ruff进行代码格式化。
要对某个库进行格式化,请在相应的库目录下运行相同的命令:
```shell
cd {model-providers|chatchat|chatchat-server|chatchat-frontend}
make format
```
此外,你可以使用format_diff命令仅对当前分支中与主分支相比已修改的文件进行格式化:
```shell
make format_diff
```
当你对项目的一部分进行了更改,并希望确保更改的部分格式正确,而不影响代码库的其他部分时,这个命令特别有用。