Skip to content

Commit 91072bd

Browse files
authored
docs: enhance dev tools usage (#981)
Signed-off-by: kwanhur <huang_hua2012@163.com>
1 parent 40400b3 commit 91072bd

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

docs/en_us/development/local_dev_guide.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,40 @@ $ git checkout -b my-cool-stuff
3939

4040
It is worth noting that before the checkout, you need to keep the current branch directory clean, otherwise the untracked file will be brought to the new branch, which can be viewed by `git status` .
4141

42+
## Install dependent tools
4243

43-
## Use `pre-commit` hook
44+
`make deps` install all the dependent tools, include `pre-commit` `goyacc` `license-eye` `staticcheck`.
45+
46+
### Use `pre-commit` hook
4447

4548
BFE developers use the [pre-commit](http://pre-commit.com/) tool to manage Git pre-commit hooks. It helps us format the source code and automatically check some basic things before committing (such as having only one EOL per file, not adding large files in Git, etc.).
4649

4750
The `pre-commit` test is part of the unit test in Travis-CI. A PR that does not satisfy the hook cannot be submitted to BFE. Install `pre-commit` first and then run it in current directory:
4851

4952
```bash
50-
$ pip install pre-commit
51-
$ pre-commit install
53+
# ensure installed pre-commit
54+
$ make deps
55+
# enable autoupdate and install hooks
56+
$ make precommit
5257
```
5358

5459
BFE modify the format of golang source code with `gofmt` .
5560

56-
57-
## Use `license-eye` tool
61+
### Use `license-eye` tool
5862

5963
[license-eye](http://github.com/apache/skywalking-eyes) helps us check and fix file's license header declaration. All files' license header should be done before committing.
6064

6165
The `license-eye` check is part of the Github-Action. A PR that check failed cannot be submitted to BFE. Install `license-eye` and do check or fix:
6266

6367
```bash
64-
$ make license-eye-install
68+
# ensure installed license-eye
69+
$ make deps
70+
# check the license header
6571
$ make license-check
72+
# fix the license header
6673
$ make license-fix
6774
```
6875

69-
7076
## Start development
7177

7278
I delete a line of README.md and create a new file in the case.

docs/zh_cn/development/local_dev_guide.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,40 @@ $ git checkout -b my-cool-stuff
3636

3737
值得注意的是,在 checkout 之前,需要保持当前分支目录 clean,否则会把 untracked 的文件也带到新分支上,这可以通过 `git status` 查看。
3838

39-
## 使用 `pre-commit` 钩子
39+
### 安装工具集
40+
41+
`make deps` 一键安装所有依赖工具,包括 `pre-commit` `goyacc` `license-eye` `staticcheck`
42+
43+
### 使用 `pre-commit` 钩子
4044

4145
BFE 开发人员使用 [pre-commit](http://pre-commit.com/) 工具来管理 Git 预提交钩子。 它可以帮助我们格式化源代码,在提交(commit)前自动检查一些基本事宜(如每个文件只有一个 EOL,Git 中不要添加大文件等)。
4246

4347
`pre-commit`测试是 Travis-CI 中单元测试的一部分,不满足钩子的 PR 不能被提交到 BFE,首先安装并在当前目录运行它:
4448

4549
```bash
46-
$ pip install pre-commit
47-
$ pre-commit install
50+
# 确保安装pre-commit
51+
$ make deps
52+
# 开启自动更新以及安装钩子
53+
$ make precommit
4854
```
4955

5056
BFE 使用 `gofmt` 来调整 golang源代码格式。
5157

52-
53-
## 使用 `license-eye` 工具
58+
### 使用 `license-eye` 工具
5459

5560
[license-eye](http://github.com/apache/skywalking-eyes) 工具可以帮助我们检查和修复所有文件的证书声明,在提交 (commit) 前证书声明都应该先完成。
5661

5762
`license-eye` 检查是 Github-Action 中检测的一部分,检测不通过的 PR 不能被提交到 BFE,安装使用它:
5863

5964
```bash
60-
$ make license-eye-install
65+
# 确保安装license-eye
66+
$ make deps
67+
# 检查所有许可证
6168
$ make license-check
69+
# 修复所有许可证
6270
$ make license-fix
6371
```
6472

65-
6673
## 开始开发
6774

6875
在本例中,我删除了 README.md 中的一行,并创建了一个新文件。

0 commit comments

Comments
 (0)