Skip to content

Commit

Permalink
Update 2023-05-20-cpp-style-guide.md
Browse files Browse the repository at this point in the history
  • Loading branch information
julyfun committed Nov 28, 2023
1 parent 690d464 commit c2fa838
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions _posts/2023-05-20-cpp-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,16 @@ author: Julyfun

![](/assets/2023-05-20-cpp-style-guide/example.jpg)

[本仓库](https://github.com/SJTU-RoboMaster-Team/style-team)代码规范的参考主要是 [Chromium C++ style guide](http://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++.md)[Google 开源项目风格指南](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/)[Rust style guide](https://github.com/rust-lang/style-team)英文部分的翻译规范参考 [C++ 参考手册](https://zh.cppreference.com/w/%E9%A6%96%E9%A1%B5),为了让翻译后文档规范且易于阅读,也参考了 Rust 中文翻译项目组的 [Rust 文档翻译指引](https://rustwiki.org/wiki/translate/rust-translation-guide/)
[本仓库](https://github.com/SJTU-RoboMaster-Team/style-team)代码规范的参考主要是 [Chromium C++ style guide](http://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++.md)[Google 开源项目风格指南](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/)[Rust style guide](https://github.com/rust-lang/style-team)

如何自动化地应用这些规范?

* 将本仓库的 `.clang-format``.clang-tidy` 文件拷贝至你的项目根目录下。
* 在编辑器中开启 `Clang-Format``Clang-Tidy` 插件。插件通常默认使用工作区根目录下的配置文件。
* 在 C++ 代码文件中执行编辑器的格式化文档操作。你也可以开启保存时自动格式化的功能。

# 代码规范 RFCs

本仓库用于讨论和确定 C++ 的代码规范,使用 Clang-Format 和 Clang-Tidy 来自动化执行风格修正。你可以在 `text` 文件夹中提交意见,并且为格式化工具提供规范。

## 风格指南如何征求意见

* 若要讨论风格规则,请你发起 GitHub issue。你需要注意:
- 精确定义你的规则,给出详尽的解释和例子。
- 你得看看有无现存的 issue 和规则已经涵盖了你的主题。
- 风格团队会关闭无休止的 issue,除非 issue 给出了新的理由或者新的方案。
* 讨论出结果的 issue 会被放入 final comment period (FCP)。
* 达成共识!

## 如何实践这些风格

使用自动化插件 Clang-Format 和 Clang-Tidy 读取本项目中的 `.clang-format``.clang-tidy` 即可。

在简单编辑环境下,你仍然可以比较轻松地践行这些规则。

## 设计原则

在设计风格指南时,风格团队试图遵循以下原则(大致按优先顺序排列):

* 可读性 🐰
- 阅读速度
- 防止误导
Expand Down

0 comments on commit c2fa838

Please sign in to comment.