mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
docs: add minor tip in CN doc and sync EN doc. (#10155)
* docs: add minor tip in CN doc and sync EN doc. * i18n: tweak --------- Co-authored-by: Chengyun Zhu <zhuchengyun.hf@outlook.com> Co-authored-by: Constrat <56174894+Constrat@users.noreply.github.com>
This commit is contained in:
@@ -85,7 +85,36 @@ Welcome to the [GitHub Pull Request Tutorial](./pr-tutorial.md) that anyone can
|
||||
|
||||
Note: operations regarding Git can be done by VS2022 instead of command line tools, using the Git changes tab.
|
||||
|
||||
## Enable clang-format in Visual Studio
|
||||
## MAA file formatting requirements
|
||||
|
||||
MAA uses a series of formatting tools to ensure that the code and resource files in the repository are visually unified for easy maintenance and reading.
|
||||
|
||||
Please ensure that it has been formatted before submission, or [enable Pre commit Hooks for automatic formatting](#use-pre-commit-hooks-to-automatically-format-code).
|
||||
|
||||
The currently enabled formatting tools are as follows:
|
||||
|
||||
|File Type | Format Tool|
|
||||
| --- | --- |
|
||||
| C++ | [clang-format](https://clang.llvm.org/docs/ClangFormat.html) |
|
||||
| Json/Yaml | [Prettier](https://prettier.io/) |
|
||||
| Markdown | [markdownlint](https://github.com/DavidAnson/markdownlint-cli2) |
|
||||
|
||||
### Use Pre-commit Hooks to Automatically Format Code
|
||||
|
||||
1. Ensure that you have Python and Node environments on your computer.
|
||||
|
||||
2. Execute the following command in the root directory of the project:
|
||||
|
||||
```bash
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
If pre-commit still cannot be used after pip install, please check if the pip installation path has been added to the PATH.
|
||||
|
||||
The formatting tool will automatically run every time you submit to ensure that your code format conforms to the style guide.
|
||||
|
||||
### Enable clang-format in Visual Studio
|
||||
|
||||
1. Install clang-format version 17 or higher.
|
||||
|
||||
|
||||
@@ -119,6 +119,8 @@ MAA 使用一系列的格式化工具来保证仓库中的代码和资源文件
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
如果pip安装后依然无法运行pre-commit,请确认pip安装地址已被添加到PATH
|
||||
|
||||
接下来,每次提交时都将会自动运行格式化工具,来确保你的代码格式符合规范
|
||||
|
||||
### 在 Visual Studio 中启用 clang-format
|
||||
|
||||
Reference in New Issue
Block a user