docs: 添加 MAA 格式化要求说明

This commit is contained in:
SherkeyXD
2024-07-21 01:45:24 +08:00
parent 184d26cad2
commit 879d136fe7
2 changed files with 30 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ order: 1
icon: iconoir:developer
---
# 开始开
# 开发前须知
## Github Pull Request 流程简述
@@ -94,7 +94,34 @@ icon: iconoir:developer
在打开 VS2022 之后,和 git 有关的操作可以不用命令行工具,直接使用 vs 自带的“Git 更改”即可
:::
## 在 Visual Studio 中启用 clang-format
## MAA 的文件格式化要求
MAA 使用一系列的格式化工具来保证仓库中的代码和资源文件美观统一,以便于维护和阅读
请确保在提交之前已经格式化,或是[启用 Pre-commit Hooks 来进行自动格式化](#利用-pre-commit-hooks-自动进行代码格式化)
目前启用的格式化工具如下:
| 文件类型 | 格式化工具 |
| --- | --- |
| C++ | [clang-format](https://clang.llvm.org/docs/ClangFormat.html) |
| Json/Yaml | [Prettier](https://prettier.io/) |
| Markdown | [markdownlint](https://github.com/DavidAnson/markdownlint-cli2) |
### 利用 Pre-commit Hooks 自动进行代码格式化
1. 确保你的电脑上有 Python 与 Node 环境
2. 在项目根目录下执行以下命令
```bash
pip install pre-commit
pre-commit install
```
接下来,每次提交时都将会自动运行格式化工具,来确保你的代码格式符合规范
### 在 Visual Studio 中启用 clang-format
1. 安装 clang-format 17 或更高版本

View File

@@ -125,7 +125,7 @@ MAA 以中文(简体)为第一语言,翻译词条均以中文(简体)
#### Windows
请参阅 [始开](./develop/development.md)。
请参阅 [开发前须知](./develop/development.md)。
#### Linux | macOS