Classification | Style | Specifications | Examples |
---|---|---|---|
Configuration file | Separated by lowercase'-' | linkis-classification level (ps/cg/mg)-service name.propertis | linkis-cg-linkismanager.properties |
Start-stop script | Separated by lowercase'-' | linkis-classification level-service name | linkis-cg-linkismanager |
Module directory | Separated by lowercase'-' | The module directory must be below the corresponding classification level, and the module name is a subdirectory | linkis-public-enhancements/linkis-bml |
Process naming | Camel case naming | Start with Linkis and end with service name | LinkisBMLApplication |
Configuration Key Naming | Separated by lowercase'.' | linkis+module name+keyName | linkis.bml.hdfs.prefix |
[Mandatory] The class, class attribute, interface method must be commented, and the comment must use the Javadoc specification, using the format of /**content*/
[Mandatory] All abstract methods (including methods in interfaces) must be annotated with Javadoc. In addition to return values, parameters, and exception descriptions, they must also indicate what the method does and what functions it implements
[Mandatory] All abstract methods (including methods in interfaces) must be annotated with Javadoc, indicating what the method does and does in addition to return values, parameters, and exception descriptions.
[Mandatory] method inside a single line comment, a separate line above the comment statement, use // comment. Multi-line comments inside methods use /* */ comments, aligned with code.
Example:
// Store the reflection relation between parameter variable like 'T' and type like Map< String, Type> typeVariableReflect = new HashMap< > (a);
Example:
/** * to monitor node status info */ public enum NodeHealthy { /** * healthy status */ Healthy, /** * EM identifies itself as UnHealthy or * The manager marks it as abnormal in the status of UnHealthy processing engine. * The manager requests all engines to withdraw forcibly (engine suicide). */ UnHealthy, /** * The engine is in the alarm state, but can accept tasks */ WARN, /** * The stock is available and can accept tasks. When the EM status is not reported for the last n heartbeats, * the Engine that has been started is still normal and can accept tasks */ StockAvailable, /** * The stock is not available. Tasks cannot be accepted */ StockUnavailable;
[Recommendation] At the same time of code modification, comments should also be modified, especially parameters, return values, exceptions, core logic, etc.
[Recommendation] Delete any unused fields, methods, and inner classes from the class; Remove any unused parameter declarations and internal variables from the method.
Carefully comment out code. Specify above, rather than simply commenting it out. If no, delete it. There are two possibilities for the code to be commented out: 1) The code logic will be restored later. 2) Never use it. The former without the comment information, it is difficult to know the annotation motivation. The latter suggestion IS deleted directly CAN, if NEED to consult historical code, log in code WAREHOUSE can.
Example:
public static final CommonVars<String> TUNING_CLASS = CommonVars.apply( "wds.linkis.cs.ha.class", "org.apache.linkis.cs.highavailable.DefaultContextHAManager"); // The following comment code should be removed // public static final CommonVars<String> TUNING_CLASS = // CommonVars.apply("wds.linkis.cs.ha.class","org.apache.linkis.cs.persistence.ProxyMethodA");