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

[Discuss] Eventmesh code style specification #444

Closed
ruanwenjun opened this issue Jul 18, 2021 · 2 comments · Fixed by #552
Closed

[Discuss] Eventmesh code style specification #444

ruanwenjun opened this issue Jul 18, 2021 · 2 comments · Fixed by #552
Labels
discussion This issue requires further discussion feature kind
Milestone

Comments

@ruanwenjun
Copy link
Member

ruanwenjun commented Jul 18, 2021

Feature Request

To ensure consistent code style and improve code quality, I think it is necessary to discuss code style specification now.
The specification includes two parts: suggest and mandatory.
The mandatory specification can be written into codestyle and checkstyle file, only pr meets the mandatory specification can be merged. Suggest specification can be break in sometimes, it's also recommended following the suggest specification.
Follow the code style specification when submitting pr and conducting code review.

Mandatory specification

  1. All package in source code should be named start with org.apache.eventmesh.{module}.
  2. Block indentation with 4 spaces.
  3. Don't exceed 100 columns.
  4. All method in interface should have clear comments.
  5. The source code files should only contain English.
  6. No more than two consecutive blank lines.
  7. Class name should be named by UpperCamelCase style, attributes and method name should be named by lowerCamelCase style, the constant should be named by CONSTANT_CASE style.
  8. Method in Unit test should be named by test{Method}_case, e.g. testHello_thorwUserException.
  9. ...

Suggest specification

  1. Each method should be as short as possible, no more than 100 lines.
  2. Each test method should test just one case and never contain more than two cases.
  3. The method name should be a verb and the Class name should be a noun.
  4. Using meaningful names and don't add comments anywhere.
  5. Using concrete data structures and avoid using Map<String, Object> to describe data.
  6. ...

Here is I can think of, welcome to add and discuss.

@qqeasonchen qqeasonchen added discussion This issue requires further discussion kind labels Jul 18, 2021
@qqeasonchen
Copy link
Contributor

Glad to see it, and it is time to Do it now.

@ruanwenjun
Copy link
Member Author

For better maintain, we can remove the code style file, since the checkstyle can also help us to format code in IDE. And we use checkstyle file to check the code style when we run GitHub CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue requires further discussion feature kind
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants