com.github.sevntu.checkstyle.checks.design.checkstyle-metadata.properties Maven / Gradle / Ivy
AvoidConditionInversionCheck.name = Avoid Condition Inversion
AvoidConditionInversionCheck.desc = This Check helps to catch condition inversion cases which could be rewritten in a more
readable manner
There're cases where it's justified to get rid of such inversion without changing
the main logic. E.g.:if (!(( a >= 8) && ( b >= 5))) { ... }
It can be rewritten as:
if ((a < 8) && (b < 5)) { ... }
if (!(a != b)) { ... }
as
if (a == b) { ... }
Sure, there're cases where we can't get rid of inversion without changing the main logic, e.g.:return !(list.isEmpty());
return !(obj instanceof SomeClass);
That's why Check has following property:
applyOnlyToRelationalOperands - if true Check will only put violation on
condition inversions with relational operands.
This option makes Check less strict, e.g.:
Using with value true does not put violation on code below:
if (! (obj instanceof SomeClass || obj1.isValid())) { ... }
@author Aleksey Nesterenko
AvoidConditionInversionCheck.applyOnlyToRelationalOperands = Avoid condition inversion only with relational operands.
CauseParameterInExceptionCheck.name = Cause Parameter In Exception
CauseParameterInExceptionCheck.desc = Checks that any Exception class which matches the defined className regexp have at least one constructor with Exception cause as a parameter.
Parameters:
Exception classNames regexp. ("classNamesRegexp" option) regexp to ignore classes by names ("ignoredClassNamesRegexp" option). The names of classes which would be considered as Exception cause ("allowedCauseTypes" option).
CauseParameterInExceptionCheck.classNamesRegexp = The regexp for the names of classes, that should be checked. Default value = ".+Exception".
CauseParameterInExceptionCheck.ignoredClassNamesRegexp = The regexp for the names of classes, that should be ignored by check.
CauseParameterInExceptionCheck.allowedCauseTypes = The names of classes which would be considered as Exception cause, separated by comma. Default value = "Throwable, Exception".
ChildBlockLengthCheck.name = Child Block Length
ChildBlockLengthCheck.desc = This check detects the child blocks, which length is more then 80% of parent block length.
Supported keywords are used to detect blocks:
"if", "else", "for", "switch", "do", "while", "try", "catch".
Rationale:
Length of child block that is more then 80% of parent block is usually hard to read in case child block is long(few display screens). Such child blocks should be refactored or moved to separate method.
ChildBlockLengthCheck.blockTypes = Option to switch the block types that will be checked.
ChildBlockLengthCheck.maxChildBlockPercentage = Maximum percentage ratio between the child block and the parent block. Default value = 80%;
ChildBlockLengthCheck.ignoreBlockLinesCount = Maximum number of lines of which block body may consist to be skipped by check.
NoMainMethodInAbstractClassCheck.name = No Main Method In Abstract Class
NoMainMethodInAbstractClassCheck.desc = Forbids main methods in abstract classes. Rationale: existance of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.
ForbidWildcardAsReturnTypeCheck.name = Forbid Wildcard As Return Type
ForbidWildcardAsReturnTypeCheck.desc = Prevents using wildcards as return type of methods.
Joshua Bloch, "Effective Java (2nd edition)" Item 28: page 137 :
"Do not use wildcard types as return types. Rather than providing additional flexibility for your users, it would force them to use wildcard types in client code. Properly used, wildcard types are nearly invisible to users of a class. They cause methods to accept the parameters they should accept and reject those they should reject. If the user of a class has to think about wildcard types, there is probably something wrong with the class\u2019s API."
ForbidWildcardAsReturnTypeCheck.checkPublicMethods = Check public methods
ForbidWildcardAsReturnTypeCheck.checkPackageMethods = Check protected-package methods
ForbidWildcardAsReturnTypeCheck.checkProtectedMethods = Check protected methods
ForbidWildcardAsReturnTypeCheck.checkPrivateMethods = Check private methods
ForbidWildcardAsReturnTypeCheck.checkOverrideMethods = Check override methods
ForbidWildcardAsReturnTypeCheck.checkDeprecatedMethods = Check deprecated methods
ForbidWildcardAsReturnTypeCheck.allowReturnWildcardWithSuper = Allow wildcard with "super". Example: "? super T"
ForbidWildcardAsReturnTypeCheck.allowReturnWildcardWithExtends = Allow wildcard with "extends". Example: "? extends T"
ForbidWildcardAsReturnTypeCheck.returnTypeClassNamesIgnoreRegex = Ignore regex for return type class names
PublicReferenceToPrivateTypeCheck.name = Public Reference To Private Type
PublicReferenceToPrivateTypeCheck.desc = This Check warns on propagation of inner private types to outer classes:
- Externally accessible method if it returns private inner type.
- Externally accessible field if it's type is a private inner type.
These types could be private inner classes, interfaces or enumerations.
Examples: class OuterClass {
public InnerClass innerFromMain = new InnerClass(); //WARNING
private class InnerClass { ... }
public InnerClass getValue() { //WARNING
return new InnerClass();
}
private interface InnerInterface { ... }
public Set<InnerInterface> getValue() { //WARNING
return new TreeSet<InnerInterface>;
}
private Enum Fruit {Apple, Pear}
public Fruit getValue() { //WARNING
return Fruit.Apple;
}
public someMethod(InnerClass innerClass) { ... } //WARNING
}
Rationale: it is possible to return
private inner type or use it as the parameter of non-private method, but it is impossible
to use it in other classes (besides inner classes)
unless it extends or implements at least one non-private class or interface.
Such situation usually happens after bulk refactoring and usually means dead/useless code
@author Aleksey Nesterenko
StaticMethodCandidateCheck.name = Static Method Candidate
StaticMethodCandidateCheck.desc = Checks whether private
methods should be declared as static
.
StaticMethodCandidateCheck.skippedMethods = Method names to skip during the check.
ConstructorWithoutParamsCheck.name = Constructor Without Params
ConstructorWithoutParamsCheck.desc = This check prohibits usage of parameterless constructors, including the default ones. Rationale: constructors of certain classes must always take arguments to properly instantiate objects.
ConstructorWithoutParamsCheck.classNameFormat = The regexp to match class names against. Default value = ".*Exception".
ConstructorWithoutParamsCheck.ignoredClassNameFormat = The regexp to select class names to ignore. Default value = "UnsupportedOperationException".
NestedSwitchCheck.name = Nested Switch
NestedSwitchCheck.desc = This check ensures that there is no switch block inside other switch block. In such case nested block should be exposed into new method.
NestedSwitchCheck.max = Maximum allowed nesting depth.
HideUtilityClassConstructorCheck.name = Hide Utility Class Constructor
HideUtilityClassConstructorCheck.desc = Make sure that utility classes (classes that contain only static methods) do not have a public constructor.
InnerClassCheck.name = Inner Class
InnerClassCheck.desc = Check nested (internal) classes to be?declared?at the bottom of the class after all methods (fields) declaration.