8月18日(周六)成都源创会火热报名中,四位一线行业大牛与你面对面,探讨区块链技术热潮下的冷思考。
Watch Star Fork

Sharding-Sphere / sharding-sphereJavaApache-2.0GVP

加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
Sharding-Sphere是一套开源的分布式数据库中间件解决方案组成的生态圈,它由Sharding-JDBC、Sharding-Proxy和Sharding-Sidecar这3款相互独立的产品组成。他们均提供标准化的数据分片、读写分离、柔性事务和数据治理功能,可适用于如Java同构、异构语言、容器、云原生等各种多样化的应用场景。 http://shardingsphere.io/
一键复制 编辑 原始数据 按行查看 历史
CODE_OF_CONDUCT.md 2.26 KB 张亮 提交于 2018-08-08 01:05 . Create CODE_OF_CONDUCT.md

Contributor Covenant Code of Conduct

Development idea

  • Write extremely clean, simplify and graceful code. Fully agree with <Refactoring: Improving the Design of Existing Code> and <Clean Code: A Handbook of Agile Software Craftsma>.

Code push conventions

  • Make sure all test cases passed.
  • Make sure test coverage not lower than dev branch.
  • Use checkstyle to check code style, provide special reason if rule violated. Find checkstyle template from sharding-sphere/src/resources/sharding_checks.xml, please use checkstyle 8.8 to run the rule.
  • Make sure mvn clean install can be success.
  • Delete unused code in time.

Code Conventions

  • Use linux line seperator.
  • Indent (including blank lines) is consistent with the previous line.
  • No unnecessary blank line.
  • All logs and java docs are in English.
  • Commit allow javadoc, todo and fixme only.
  • Give a meaningful variable name. The name of return value is result; The name of unit value is each in for each sentence, instead of entry for map iterator.
  • Name of properties file is camel-case, first letter is lowercase.
  • Constant on left and variable on right in conditional expression.
  • The nested loop should extract to a new private method.
  • Replace Nested Conditional with Guard Clauses.
  • Access permissions for classes and methods should minimal as possible.
  • Parameters and return value are not allowed to be null.
  • If use comment to explain the code, try to split several small methods, and use method name to explain it.
  • Use lombok instead of the constructor, getter, setter methods and log variable.
  • keep style consistent with existed code.
  • No duplicate code and configuration.

Unit Test Conventions

  • Test code and production code equality, should follow the same code conventions.
  • Test cases should fully covered if no special reason.
  • Separate environment preparation codes and test codes.
  • Only junit Assert, hamcrest CoreMatchers, Mockito related can use static import.
  • For single parameter assert, should use assertTrue, assertFalse, assertNull and assertNotNull.
  • For multiple parameters assert, should use assertThat.
  • Assert accurately, do not use not, containsString and so on.
  • Use actualXXX and expectedXXX to name related variable.

评论 ( 0 )

你可以在登录后,发表评论