CalvinKirs commented on code in PR #2995:
URL: 
https://github.com/apache/incubator-seatunnel/pull/2995#discussion_r989952262


##########
docs/en/contribution/coding-guide.md:
##########
@@ -0,0 +1,101 @@
+# Coding guide
+
+1. Create entity classes using annotations in the `lombok` plugin (`@Data` 
`@Getter` `@Setter` `@NonNull` etc...) to reduce the amount of code
+
+2. If you need to use log4j to print logs in a class, preferably use the 
annotation `@Slf4j` in the `lombok` plugin
+
+3. Issue, pr submission specification:
+
+   > Title specification: [purpose] [module name] Description
+
+   1. pr purpose includes: `Hotfix`, `Feature`, `Improve`, `Bug`, `Docs`, `WIP`
+   2. issue purpose includes: `Feature`, `Bug`, `Docs`, `WIP`, `Discuss`
+   3. module name: the current pr or issue involves the name of the module, 
for example: `Core`, `Connector-V2`, `Connector-V1`, etc.
+   4. description: highly summarize what the current pr and issue to do, as 
far as possible to do the name to know the meaning
+
+4. The community code style has the following specifications (it is 
recommended to use the auto-formatted code feature of idea).
+
+   > https://github.com/apache/incubator-seatunnel/pull/2641
+   >
+   > #2641 will introduce the spotless plugin, contributors need to use the 
plugin to format the code before submitting pr
+   1. Indent to 4 spaces
+   2. Keyword (try if else catch...) there should be 1 space between keyword 
and `(`
+   3. There should be 1 space between `)` and `{`
+   4. There should be 1 space between parameter splitting
+   5. If there are more than 3 chain calls, there should be a separate line 
for each call
+   6. If-else should be wrapped in `{}` even if the method body is only one 
line
+   7. etc....
+
+5. Code segments are never repeated. If a code segment is used multiple times, 
you should not define it multiple times, but make it a public segment for other 
modules to use
+
+6. When throwing an exception, you need to throw the exception along with a 
hint message. For example, if your connector encounters an `IOException` while 
reading data, a reasonable approach would be to the following:
+
+   ```java
+   try {
+       // read logic
+   } catch (IOException e) {
+       throw RuntimeException("Meet a IOException, it might has some problems 
between client and database", e);

Review Comment:
   This is a wrong example, IoException is too broad and it is not a good 
practice, refer to what I said above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to