如何参与HBase社区建设-01-Code Style

背景

不同开发者的代码习惯、IDE不同,社区需要统一代码格式,方便其他开发者阅读代码

以下内容从官网查找到的,不保证及时更新,对社区的贡献工作需要大家自驱,任何疑问,先多看官网给出的经验和说明

不按照格式开发的话,社区的Hadoop QA自动跑得测试是通不过的:)

1.加载hbase官方的Java code style

查看官网以下内容

http://hbase.apache.org/book.html#eclipse.code.formatting

从git上拉取hbase代码dev-support/ 目录下面找到hbase_eclipse_formatter.xml

IDE打开preferences->搜索code style 

将hbase_eclipse_formatter.xml加载进来

image2019-3-19%2016%3A51%3A45.png?version=1&modificationDate=1552985505000&api=v2uploading.4e448015.gif转存失败重新上传取消image2019-3-19%2016%3A51%3A45.png?version=1&modificationDate=1552985505000&api=v2uploading.4e448015.gif转存失败重新上传取消image2019-3-19%2016%3A51%3A45.png?version=1&modificationDate=1552985505000&api=v2uploading.4e448015.gif转存失败重新上传取消

 

因为IDEA和Eclipse的import 格式设置不太一样,IDEA还要做的改动:

取消星号导包

http://www.cnblogs.com/nihaorz/p/6762421.html

import部分的顺序,底下的具体设置

image2019-3-19%2016%3A52%3A15.png?version=1&modificationDate=1552985535000&api=v2uploading.4e448015.gif转存失败重新上传取消image2019-3-19%2016%3A52%3A15.png?version=1&modificationDate=1552985535000&api=v2uploading.4e448015.gif转存失败重新上传取消image2019-3-19%2016%3A52%3A15.png?version=1&modificationDate=1552985535000&api=v2uploading.4e448015.gif转存失败重新上传取消

 

通过IDEA的command+ option+L格式化代码

2.jruby 的code style 验证

jruby格式验证使用的是另外一个工具:rubocop

安装:

gem install rubocop

中文说明

https://github.com/JuanitoFatas/ruby-style-guide/blob/master/README-zhCN.md

另外,可能看中文说明也不一定能找到解决方案

直接通过返回的关键字到stackoverflow上面搜索

 

以上只做了java和jruby的代码格式化说明,关于shell脚本等格式验证没有经过尝试,期待同学们提出新的补充说明

 

Tips

1、目前java 代码中switch ...case ....代码块的格式需要手动处理一下

默认格式化之后:

switch (){

case xxx

case xxx

....

 

实际需要的格式,需要case前面再加2个空格

switch (){

  case xxx

  case xxx

....

 

 

2.jruby 代码command+ option+L 格式化之后,还是有一些rubocop验证通不过的

需要本地rubocop命令验证之后,根据返回信息修改的进行修改,然后再提交到jira上

 

 

总结

以上内容其实是需要大家自驱去了解的,官网不但给出了流程,还给出了很多提交的建议和例子,任何是请没有头绪的时候,主动看官网

 

 

官网答案

http://hbase.apache.org/book.html#submitting.patches.create

流程

1.下载代码

主要还是看官网

http://hbase.apache.org/book.html#_configuration_from_scratch

2.编译

官网

http://hbase.apache.org/book.html#_build_a_tarball

3.如果修改了pb文件编译pl

官网也给出了命令

http://hbase.apache.org/book.html#build.protobuf

4.提交

http://hbase.apache.org/book.html#submitting.patches

4.1代码code style

http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=195801058

4.2 各种操作

4.2.1.注册账号

4.2.2.create一个新的issue

4.2.3.提交master branch的改进patch先

4.2.4.提交方法见:http://hbase.apache.org/book.html#submitting.patches.create

4.2.5.hbase有一个py脚本协助大家提交

4.2.6.提交之后可能会有committer跑来围观

4.2.7.patch会触发Hadoop QA自动跑单元测试和代码格式验证(发现传图片也会触发机器人跑单测,吐血)

4.2.8.跑完@ committer帮你review

4.3 各种测试的补充

4.4.代码上传review board(现在注册功能被禁止了:)…等apache的review board重新可以注册了再上传吧..

现在先让其他人在issue评论区增加评论

5.社区的一些建议

Becoming a committer

Committers are responsible for reviewing and integrating code changes, testing and voting on release candidates, weighing in on design discussions, as well as other types of project contributions. The PMC votes to make a contributor a committer based on an assessment of their contributions to the project. It is expected that committers demonstrate a sustained history of high-quality contributions to the project and community involvement.

Contributions can be made in many ways. There is no single path to becoming a committer, nor any expected timeline. Submitting features, improvements, and bug fixes is the most common avenue, but other methods are both recognized and encouraged (and may be even more important to the health of HBase as a project and a community). A non-exhaustive list of potential contributions (in no particular order):

简单概括:社区贡献可以多种多样,没有单一路径去成为一个committer。也没有任何预期的时间表

Update the documentation for new changes, best practices, recipes, and other improvements.

更新文档,最佳实践,各种方法,其他改进

Keep the website up to date.

保持网站的更新

Perform testing and report the results. For instance, scale testing and testing non-standard configurations is always appreciated.

各种场景的测试结果

Maintain the shared Jenkins testing environment and other testing infrastructure.

维护测试环境

Vote on release candidates after performing validation, even if non-binding. A non-binding vote is a vote by a non-committer.

对提交内容的投票

Provide input for discussion threads on the mailing lists (which usually have [DISCUSS] in the subject line).

Answer questions questions on the user or developer mailing lists and on Slack.

回答邮件列表的问题

Make sure the HBase community is a welcoming one and that we adhere to our Code of conduct. Alert the PMC if you have concerns.

维护HBase社区热度

Review other people’s work (both code and non-code) and provide public feedback.

review其他人的代码并提供反馈

Report bugs that are found, or file new feature requests.

report bug和新的改进

Triage issues and keep JIRA organized. This includes closing stale issues, labeling new issues, updating metadata, and other tasks as needed.

对jira的信息做 关闭,更新 分类等管理

Mentor new contributors of all sorts.

指导各种新的contributors

Give talks and write blogs about HBase. Add these to the News section of the website.

HBase 博客

Provide UX feedback about HBase, the web UI, the CLI, APIs, and the website.

提供有关HBase,Web UI,CLI,API和网站的UX反馈

Write demo applications and scripts.

示例应用和脚本

Help attract and retain a diverse community.

增加社区吸引力,和多元化发展

Interact with other projects in ways that benefit HBase and those other projects.

和其他有关HBase的项目进行互动

Not every individual is able to do all (or even any) of the items on this list. If you think of other ways to contribute, go for it (and add them to the list). A pleasant demeanor and willingness to contribute are all you need to make a positive impact on the HBase project. Invitations to become a committer are the result of steady interaction with the community over the long term, which builds trust and recognition.

概述:以上列表只是建议但并没有任何强制和约束,大家可以增加列表内容,任何有利于社区的action都会被接受,成为committer需要长期并稳定参与社区建设

总结

1.有问题先看官网

2.多了解社区最新动态

3.订阅hbase邮件列表

4.从多个角度考虑社区发展

5.提交的问题是否通用

6.是否实际解决了问题,给HBase用户和管理员带来了收益

7.社区和内部的各种改进,都先经过讨论再进行,以防止很多工作需要重做 

 

 

 

175. Apache HBase Repositories

Apache HBase consists of multiple repositories which are hosted on Apache GitBox. These are the following:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值