Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: update codereview docs for team1. #76

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions docs/codereview-activity/A.2024-02-21.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,26 @@
* 推荐使用统一的log库
* 作为一个集体,工程规范应尽可能统一





* https://github.com/goplus/community/pull/148#discussion_r1494609866
* 代码风格,尽量遵循Go的风格,尤其是命名,减少map等不固定长度的数据结构作为参数或者返回值
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

减少map等不固定长度的数据结构作为参数或者返回值 这一句哪里有出处吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Golang好像没有具体的条例限制,但是有侧面反应推荐使用结构体,主要基于类型安全和代码可读性的考虑。结构体提供了明确的类型信息

部分社区中的反馈:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在一些场景下,明确的结构体确实是能增强可读性,但直接推到为结论 减少map等不固定长度的数据结构作为参数或者返回值 有点过于武断。

实际上在我看来,在具体业务场景下这些决策是顺水渠成的。

比如我们这里,确实是不推荐直接用map,因为这里它应该固定长度的,且有明确语义。而这个语义,可能还需要别人理解的,所以用一个明确的名字会更好。

* https://github.com/goplus/community/pull/148#discussion_r1494612992
* 单元测试,尽量覆盖所有的分支,使用assert抛出问题
* https://github.com/goplus/community/pull/168/files#r1497894587
* 前端部分代码需要保证本地测试通过
* https://github.com/goplus/community/pull/127#issuecomment-1932663028
* Commit记录,尽量保持清晰,不要包含无关的信息,多用rebase少用merge
* https://github.com/goplus/community/pull/108#discussion_r1478493291
* 保证comment的质量,以及合并的代码comment不用中文
* https://github.com/goplus/community/pull/100#discussion_r1479140319
* 避免无意义的提交,暂存的代码不要提交,可以放本地gitignore
* https://github.com/goplus/community/pull/168#discussion_r1498561221
* 看起来是个测试代码,正式提交时需要注释,或者是需要的代码,但是src部分是写死的
* https://github.com/goplus/community/pull/168#discussion_r1498561761
* push之前需同步
* https://github.com/goplus/community/pull/159#discussion_r1498565877
* 减少打包文件的提交,将用到的文件上传到需要的位置
* https://github.com/goplus/community/pull/164
* 过多的魔法值:"auto",抽出当常量使用

## Reference

Expand Down
Loading