What is Quality and how to achieve it?
Quality Java code, as we understand it, compiles and complies to static analysis rules. Qulice uses a number of open-source components (in order to avoid reinventing the wheel). We pre-configured these tools for your convenience and extended them with our specific rules.
Checkstyle
Our custom rules:
- BracketsStructure
- CascadeIndentation
- ConditionalRegexpMultiline
- ConstantUsage
- ConstructorsCodeFree
- ConstructorsOrder
- CurlyBracketsStructure
- DiamondOperator
- EmptyLineBeforeFirstMember
- EmptyLines
- EnumValueName
- ExtraSemicolon
- FinalSemicolonInTryWithResources
- ImportCohesion
- JavadocEmptyLine
- JavadocFirstLine
- JavadocLocation
- JavadocParameterOrder
- JavadocTags
- JavadocTagsDot
- JavadocThrows
- MethodBodyComments
- MethodDeclarationLength
- MethodsOrder
- MultiLineComment
- MultilineJavadocTags
- NestedSwitch
- NoJavadocForOverriddenMethods
- NonStaticMethod
- ProhibitFieldsInTestClasses
- ProhibitLineSeparatorInStrings
- ProhibitTestExpected
- ProhibitTestMethodName
- ProtectedMethodInFinalClass
- QualifyInnerClass
- SimpleStringSplit
- SingleLineComment
- StaticAccessViaInstance
- StringLiteralsConcatenation
If you want to disable some rule (this may happen, but try to avoid such situations at all cost):
/**
* @checkstyle ParameterNumber (3 lines)
*/
public void funcWithManyParams(int a, int b, int c, int d) {
// @checkstyle MagicNumber (1 line)
int num = 5;
// ...
}PMD
Our custom rules:
- ProhibitPlainJunitAssertionsRule
- UnitTestContainsTooManyAsserts
- UnitTestShouldIncludeAssert
- UnnecessaryLocalRule
- UseStringIsEmptyRule
- AvoidAccessToStaticMembersViaThis
- AvoidDirectAccessToStaticFields
- ConstructorOnlyInitializesOrCallOtherConstructors
- ConstructorShouldDoInitialization
- JUnitTestClassShouldBeFinal
- OnlyOneConstructorShouldDoInitialization
- ProhibitFilesCreateFileInTests
- ProhibitPublicStaticMethods
Rules can be disabled (again, try to avoid this at all cost):
@SuppressWarnings("PMD.UseConcurrentHashMap")
public void func() {
Map<String, String> map = new HashMap<String, String>();
// ...
}