forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 1
CodeNark vs Checkstyle checks
Roman Ivanov edited this page Jan 30, 2015
·
13 revisions
The page contains comparison of Checks from diffrent tools.
Goal: make a list of checks that can be implemented in Checkstyle.
Note: this document is not final. It describes intentions but cannot be treated as roadmap.
Feel fre to modify it or create document that compares Checkstyle checks with other tool's checks.
CodeNark rules http://codenarc.sourceforge.net/codenarc-rule-index.html
Checkstyle rules http://checkstyle.sourceforge.net/checks.html
for additional comments see : google docs
CodeNark Basic | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
AssertWithinFinallyBlock | Low | Is it needed? Do we use assert in PROD code? |
AssignmentInConditional | InnerAssignment | |
BigDecimalInstantiation | Medium | Basing on IllegalInstantiation? |
BitwiseOperatorInConditional | Medium | |
BooleanGetBoolean | Medium | Based on IllegalInstantiation? |
BrokenNullCheck | Medium | |
BrokenOddnessCheck | Not planned | Don't like it |
ClassForName | Not planned | Not used on my projects |
ComparisonOfTwoConstants | Not planned | |
ComparisonWithSelf | Not planned | |
ConstantAssertExpression | N/A | Groovy Power Assert specific? |
ConstantIfExpression | Medium | |
ConstantTernaryExpression | Medium | |
DeadCode | N/A | Controlled by compiler |
DoubleNegative | Not planned | |
DuplicateCaseStatement | N/A | Controlled by compiler |
DuplicateMapKey | N/A | Controlled by compiler |
DuplicateSetValue | N/A | Groovy specific |
EmptyCatchBlock | High | We have issue on that in Checkstyle project, will be done soon for cover Google's style |
EmptyClass | Not planned | Strange rule |
EmptyElseBlock | High | Basing on EmptyStatement? |
EmptyFinallyBlock | High | Basing on EmptyStatement? |
EmptyForStatement | High | Basing on EmptyStatement? |
EmptyIfStatement | High | Basing on EmptyStatement? |
EmptyInstanceInitializer | High | Basing on EmptyStatement? |
EmptyMethod | High | Basing on EmptyStatement? |
EmptyStaticInitializer | High | Basing on EmptyStatement? |
EmptySwitchStatement | High | Basing on EmptyStatement? |
EmptySynchronized Statement | High | Basing on EmptyStatement? |
EmptyTryBlock | High | Basing on EmptyStatement? |
EmptyWhileStatement | High | Basing on EmptyStatement? |
EqualsAndHashCode | EqualsHashCode | |
EqualsOverloaded | High | |
ExplicitGarbageCollection | High | |
ForLoopShouldBeWhileLoop | High | |
HardCodedWindowsFileSeparator | High | |
HardCodedWindowsRootDirectory | Medium | |
IntegerGetInteger | High | |
MultipleUnaryOperators | Not planned | Is it needed? |
RandomDoubleCoercedToZero | High | |
RemoveAllOnSelf | High | |
ReturnFromFinallyBlock | High | Exists in sevntu |
ThrowExceptionFromFinallyBlock | High |
CodeNark Braces | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
ElseBlockBraces | LeftCurly | |
ForStatementBraces | LeftCurly | |
IfStatementBraces | LeftCurly | |
WhileStatementBraces | LeftCurly |
CodeNark Concurrency | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
BusyWait | High | |
DoubleCheckedLocking | High | |
InconsistentPropertyLocking | High | |
InconsistentPropertySynchronization | High | |
NestedSynchronization | High | |
StaticCalendarField | High | |
StaticConnection | High | |
StaticDateFormatField | High | |
StaticMatcherField | High | |
StaticSimpleDateFormatField | High | |
SynchronizedMethod | High | |
SynchronizedOnBoxedPrimitive | High | |
SynchronizedOnGetClass | High | |
SynchronizedOnReentrantLock | High | |
SynchronizedOnString | High | |
SynchronizedOnThis | High | |
SynchronizedReadObjectMethod | High | |
SystemRunFinalizersOnExit | High | |
ThisReferenceEscapesConstructor | High | |
ThreadGroup | High | |
ThreadLocalNotStaticFinal | High | |
ThreadYield | High | |
UseOfNotifyMethod | High | |
VolatileArrayField | High | |
VolatileLongOrDoubleField | High | |
WaitOutsideOfWhileLoop | High |
CodeNark Convention | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
ConfusingTernary | High | Exists in sevntu |
CouldBeElvis | N/A | Groovy specific |
HashtableIsObsolete | High | I think IllegalType could do that |
IfStatementCouldBeTernary | High | |
InvertedIfElse | High | Exists in sevntu |
LongLiteralWithLowerCaseL | UpperEll | |
NoDef | N/A | Groovy specific |
ParameterReassignment | High | I do believe we have it, need to recheck |
TernaryCouldBeElvis | N/A | Groovy specific |
VectorIsObsolete | High | that could be done by IllegalImport , but I think we needto have checkthat forbid usage of type at all |
CodeNark Design | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
AbstractClassWithPublicConstructor | High | Oposit to MissingCtor |
AbstractClassWithoutAbstractMethod | High | |
BooleanMethodReturnsNull | High | Exists in sevntu |
BuilderMethodWithSideEffects | High | |
CloneableWithoutClone | High | |
CloseWithoutCloseable | High | |
CompareToWithoutComparable | High | |
ConstantsOnlyInterface | InterfaceIsType | |
EmptyMethodInAbstractClass | High | |
FinalClassWithProtectedMember | High | |
ImplementationAsType | IllegalType | |
Instanceof | High | |
LocaleSetDefault | High | |
PrivateFieldCouldBeFinal | FinalLocalVariable | |
PublicInstanceField | VisibilityModifier | |
ReturnsNullInsteadOfEmptyArray | High | Exists in sevntu |
ReturnsNullInsteadOfEmptyCollection | High | Exists in sevntu |
SimpleDateFormatMissingLocale | High | |
StatelessSingleton | High | |
ToStringReturnsNull | High | :), that is weird, wecan not predict all stupitity of human |
CodeNark Dry | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
DuplicateListLiteral | N/A | Groovy specific |
DuplicateMapLiteral | N/A | Groovy specific |
DuplicateNumberLiteral | MagicNumber | |
DuplicateStringLiteral | High |
CodeNark Enhanced | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
CloneWithoutCloneable | High | |
JUnitAssertEqualsConstantActualValue | High | |
UnsafeImplementationAsMap | N/A | Groovy specific |
CodeNark Exceptions | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
CatchArrayIndexOutOfBoundsException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchError | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchIllegalMonitorStateException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchIndexOutOfBoundsException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchNullPointerException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchRuntimeException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CatchThrowable | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
ConfusingClassNamedException | High | |
ExceptionExtendsError | High | |
ExceptionExtendsThrowable | High | |
ExceptionNotThrown | High | |
MissingNewInThrowStatement | N/A | Groovy specific |
ReturnNullFromCatchBlock | High | that is questionalble , as it shouldbe covered by OneReturn check |
SwallowThreadDeath | Not planned | Strange rule |
ThrowError | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
ThrowException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
ThrowNullPointerException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
ThrowRuntimeException | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
ThrowThrowable | IllegalCatch | Can be defined by IllegalCatch. Need to describe configuration in docs. |
CodeNark Formatting | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
BlankLineBeforePackage | EmptyLineSeparator | |
BracesForClass | LeftCurly, RightCurly | |
BracesFor ForLoop | LeftCurly, RightCurly | |
BracesFor IfElse | LeftCurly, RightCurly | |
BracesFor Method | LeftCurly,RightCurly | |
BracesFor TryCatchFinally | LeftCurly, RightCurly | |
ClassJavadoc | JavaDoc* | |
ClosureStatementOnOpeningLineOfMultipleLineClosure | All indentation checks? | |
ConsecutiveBlankLines | Medium | EmptyLineSeparator |
FileEndsWithoutNewline | NewlineAtEndOfFile | |
LineLength | LineLength | |
MissingBlankLineAfterImports | EmptyLineSeparator | |
MissingBlankLineAfterPackage | EmptyLineSeparator | |
SpaceAfterCatch | *Whitespace* | |
SpaceAfterClosingBrace | *Whitespace* | |
SpaceAfterComma | *Whitespace* | |
SpaceAfterFor | *Whitespace* | |
SpaceAfterIf | *Whitespace* | |
SpaceAfterOpeningBrace | *Whitespace* | |
SpaceAfterSemicolon | *Whitespace* | |
SpaceAfterSwitch | *Whitespace* | |
SpaceAfterWhile | *Whitespace* | |
SpaceAroundClosureArrow | *Whitespace* | |
SpaceAroundMapEntryColon | *Whitespace* | |
SpaceAroundOperator | *Whitespace* | |
SpaceBeforeClosingBrace | *Whitespace* | |
SpaceBeforeOpeningBrace | *Whitespace* | |
TrailingWhitespace | *Whitespace* |
CodeNark Generic | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
IllegalClassMember | Medium | |
IllegalClassReference | High | |
IllegalPackageReference | High | |
IllegalRegex | Low | |
IllegalString | Low | We have regExp Checks |
IllegalSubclass | Low | |
RequiredRegex | Low | |
RequiredString | Low | |
StatelessClass | Low |
CodeNark Imports | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
DuplicateImport | RedundantImport | |
ImportFromSamePackage | RedundantImport | |
ImportFromSunPackages | RedundantImport | |
MisorderedStaticImports | ImportOrder | |
NoWildcardImports | AvoidStarImport | |
UnnecessaryGroovyImport | N/A | Groovy specific |
UnusedImport | UnusedImports |
CodeNark Jdbc | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
DirectConnectionManagement | Medium | I am not in favor of specific rules, but we could think about illegalMethodCall, and it will skip alot of cases where type is created in one file and getConneciton is called from another file |
JdbcConnectionReference | N/A | Groovy specific |
JdbcResultSetReference | N/A | Groovy specific |
JdbcStatementReference | N/A | Groovy specific |
CodeNark Junit | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
ChainedTest | High | I have never though abuot that group, as I mostly suppress Checks in Test area, as Tests are hacks and most Checks doe snot work in test classes. But we could think about some useful |
CoupledTestCase | High | |
JUnitAssertAlwaysFails | High | |
JUnitAssertAlwaysSucceeds | High | |
JUnitFailWithoutMessage | High | |
JUnitLostTest | High | |
JUnitPublicField | High | |
JUnitPublicNonTestMethod | High | |
JUnitPublicProperty | High | |
JUnitSetUpCallsSuper | High | |
JUnitStyleAssertions | High | |
JUnitTearDownCallsSuper | High | |
JUnitTestMethodWithoutAssert | High | |
JUnitUnnecessarySetUp | High | |
JUnitUnnecessaryTearDown | High | |
JUnitUnnecessaryThrowsException | High | |
SpockIgnoreRestUsed | N/A | Groovy specific |
UnnecessaryFail | High | |
UseAssertEqualsInsteadOfAssertTrue | High | |
UseAssertFalseInsteadOfNegation | High | |
UseAssertNullInsteadOfAssertEquals | High | |
UseAssertSameInsteadOfAssertTrue | High | |
UseAssertTrueInsteadOfAssertEquals | High | |
UseAssertTrueInsteadOfNegation | High |
CodeNark Logging | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
LoggerForDifferentClass | High | that is good group of checks |
LoggerWithWrongModifiers | High | |
LoggingSwallowsStacktrace | High | consider sevntu issue 286 |
MultipleLoggers | High | |
PrintStackTrace | High | |
Println | N/A | Groovy specific |
SystemErrPrint | High | [check to detect](http://roman-ivanov.blogspot.com/ 2013/10/checkstyle-check-to-detect.html) |
SystemOutPrint | High |
CodeNark Naming | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
AbstractClassName | AbstractClassName? | |
ClassName | TypeName | |
ClassNameSameAsFilename | OuterTypeFilename | |
ConfusingMethodName | High | |
FactoryMethodName | High | |
FieldName | MemberName | |
InterfaceName | TypeName | |
MethodName | MethodName | |
ObjectOverrideMisspelledMethodName | Low | Do we need it? We have EqualsHashCode that partially resolves the issue |
PackageName | EqualsHashCode | |
PackageNameMatchesFilePath | PackageDeclaration | |
ParameterName | ParameterName | |
PropertyName | MemberName | |
VariableName | LocalVariableName |
CodeNark Security | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
FileCreateTempFile | High | |
InsecureRandom | High | |
JavaIoPackageAccess | High | |
NonFinalPublicField | High | |
NonFinalSubclassOfSensitiveInterface | High | |
ObjectFinalize | High | |
PublicFinalizeMethod | High | |
SystemExit | High | |
UnsafeArrayDeclaration | High |
CodeNark Serialization | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
EnumCustomSerializationIgnored | High | |
SerialPersistentFields | High | |
SerialVersionUID | High | |
SerializableClassMustDefineSerialVersionUID | High |
CodeNark Size | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
AbcMetric | N/A | (Requires the GMetrics jar) DEPRECATED |
ClassSize | Similar to FileLength | |
CrapMetric | Low | (Requires the GMetrics jar and a Cobertura coverage file) Hard to implement |
CyclomaticComplexity | Low | (Requires the GMetrics jar) Hard to implement |
MethodCount | MethodCount | |
MethodSize | MethodLength | |
NestedBlock Depth | Nested* |
CodeNark Unnecessary | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
AddEmptyString | N/A | It's OK in Java |
ConsecutiveLiteralAppends | N/A | It's OK in Java |
ConsecutiveStringConcatenation | N/A | It's OK in Java |
UnnecessaryBigDecimalInstantiation | N/A | Groovy specific |
UnnecessaryBigIntegerInstantiation | N/A | Groovy specific |
UnnecessaryBooleanExpression | Medium | Need to extend SimplifyBoolean Expression |
UnnecessaryBooleanInstantiation | High | |
UnnecessaryCallForLastElement | N/A | Groovy specific |
UnnecessaryCallToSubstring | Medium | |
UnnecessaryCast | High | |
UnnecessaryCatchBlock | Not planned | Is it really needed? |
UnnecessaryCollectCall | N/A | Groovy specific |
UnnecessaryCollectionCall | Not planned | Is it really needed? |
UnnecessaryConstructor | High | Sevntu |
UnnecessaryDefInFieldDeclaration | N/A | Groovy specific |
UnnecessaryDefInMethodDeclaration | N/A | Groovy specific |
UnnecessaryDefInVariableDeclaration | N/A | Groovy specific |
UnnecessaryDotClass | N/A | Groovy specific |
UnnecessaryDoubleInstantiation | High | |
UnnecessaryElseStatement | High | that refacrtoring is weird, as it should keep and return as last statement and keep IF-ELSE |
UnnecessaryFinalOnPrivateMethod | High | |
UnnecessaryFloatInstantiation | High | |
UnnecessaryGString | N/A | Groovy specific |
UnnecessaryGetter | N/A | Groovy specific |
UnnecessaryIfStatement | High | |
UnnecessaryInstanceOfCheck | High | |
UnnecessaryInstantiationToGetClass | High | |
UnnecessaryIntegerInstantiation | High | |
UnnecessaryLongInstantiation | High | |
UnnecessaryModOne | Not planned | Is it needed? |
UnnecessaryNullCheck | N/A | Groovy specific |
UnnecessaryNullCheck BeforeInstanceOf | High | |
UnnecessaryObjectReferences | N/A | Groovy specific |
UnnecessaryOverridingMethod | High | |
UnnecessaryPackageReference | High | |
UnnecessaryParenthesesFor MethodCallWithClosure | N/A | Groovy specific |
UnnecessaryPublicModifier | N/A | Groovy specific |
UnnecessaryReturnKeyword | N/A | Groovy specific |
UnnecessarySafeNavigationOperator | N/A | Groovy specific |
UnnecessarySelfAssignment | High | |
UnnecessarySemicolon | N/A | Groovy specific |
UnnecessaryStringInstantiation | High | |
Unnecessary Substring | N/A | Groovy specific |
UnnecessaryTernaryExpression | High | |
UnnecessaryToString | High | |
UnnecessaryTransientModifier | High |
CodeNark Unused | CheckStyle check or implementation priotiry |
Comments |
---|---|---|
UnusedArray | High | |
UnusedMethodParameter | High | |
UnusedObject | High | |
UnusedPrivateField | High | |
UnusedPrivateMethod | High | |
UnusedPrivateMethodParameter | High | |
UnusedVariable | High |