WIP from VB
Since Sqoop2 is primarily JAVA, we will be using the google JAVA coding standards for the most parts.
http://www.infoq.com/news/2014/02/google-java-coding-standards
- No wildcard imports.
- Overloads appear sequentially.
- Braces are used even when the body is empty or contains a single statement.
- 2 spaces indentation.
- Column limit can be 80 or 100 characters.
- No C-style array declarations.
- The default statement in switch statements are required.
- Modifiers appear in the order recommended by the Java Language Specification.
- Constants use CONSTANT_CASE. Note that every constant is a static final field, but not all static final fields are constants.
Wild card imports
Unless the entire set of imports are used in the file. For example in DerbySchemaUpgradeQuery.java
every single constant in DerbySchemaConstants
is used. In this case, it is ok to use wildcard.
Column Limit and Line Wrapping
https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.4-column-limit
We will use the 100 character limit.
Import Order and Grouping
- All static imports in a single group
com.*
imports (only if this source file is in thecom.google
package space)- Third-party imports, one group per top-level package, in ASCII sort order
java
imports- for example:
android
,com
,junit
,org
,sun
- for example:
java imports
javax
imports
Few more conventions in Sqoop
- All test classes should be in the exact same package hierarchy as the source java class
- All test classes should begin with
Test
for instanceTestCSVInternmediateFormat.java
instead ofCSVIntermediateFormatTest
- Naming a variable, a class, a method name should be self-explanatory, if not add sufficient comments explaining what the code does.
Some conventions in Sqoop that may not be standards!
Dont ask me which coding standard prescribes, but it exists and the committers follow this religiously!. So do not waste your time following standards.
- Enum classes, the semicolon needs to be in its own line.
public enum AuditLoggerError implements ErrorCode { /** An unknown error has occurred. */ AUDIT_0000("An unknown error has occurred"), /** The system was unable to find or load the audit logger provider. */ AUDIT_0001("The system was unable to find or load audit logger class"), /** The audit logger output file is not given. */ AUDIT_0002("The output file for FileAuditLogger is not given"), ;
Before you get on to uploading the patch, also read this wiki that will help with getting through larger feature reviews quicker