cushon / issues-import

0 stars 0 forks source link

Implement impactful checks from IntelliJ InspectionGadgets plugin #92

Open cushon opened 10 years ago

cushon commented 10 years ago

Original issue created by aeagle22206 on 2013-02-25 at 02:11 AM


Full list of checks in the plugin: (to figure out what each means, have to look at sources: https://github.com/JetBrains/intellij-community/tree/master/plugins/InspectionGadgets )

<!--group.names.abstraction.issues-->

CastToConcreteClass ClassReferencesSubclass DeclareCollectionAsInterface FeatureEnvy InstanceVariableOfConcreteClass InstanceofChain InstanceofInterfaces InstanceofThis LocalVariableOfConcreteClass MagicNumber MethodOnlyUsedFromInnerClass MethodReturnOfConcreteClass OverlyStrongTypeCast ParameterOfConcreteClass PublicMethodNotExposedInInterface StaticMethodOnlyUsedInOneClass StaticVariableOfConcreteClass TypeMayBeWeakened

AssignmentToCatchBlockParameter AssignmentToCollectionFieldFromParameter AssignmentToDateFieldFromParameter AssignmentToForLoopParameter AssignmentToMethodParameter AssignmentToNull AssignmentToStaticFieldFromInstanceMethod AssignmentUsedAsCondition IncrementDecrementUsedAsExpression NestedAssignment ReplaceAssignmentWithOperatorAssignment

IncompatibleMask PointlessBitwiseExpression ShiftOutOfRange

ArchaicSystemPropertyAccess ArrayEquality ArrayEquals ArrayHashCode AssertWithSideEffects ConstantAssertCondition CastConflictsWithInstanceof CastToIncompatibleInterface ClassNewInstance CollectionAddedToSelf ComparableImplementedButEqualsNotOverridden ComparatorMethodParameterNotUsed CompareToUsesNonFinalVariable CovariantCompareTo CovariantEquals EmptyInitializer EmptyStatementBody EqualsBetweenInconvertibleTypes EqualsUsesNonFinalVariable EqualsWhichDoesntCheckParameterClass ThrowableInstanceNeverThrown ForLoopThatDoesntUseLoopVariable HashCodeUsesNonFinalVariable IgnoreResultOfCall ImplicitArrayToString InfiniteRecursion InstanceofIncompatibleInterface InstantiationOfUtilityClass IteratorHasNextCallsIteratorNext IteratorNextDoesNotThrowNoSuchElementException MalformedFormatString MalformedRegex MalformedXPath MathRandomCastToInt MismatchedArrayReadWrite MismatchedCollectionQueryUpdate MismatchedStringBuilderQueryUpdate MisspelledCompareTo MisspelledHashcode MisspelledEquals MisspelledToString NewStringBufferWithCharArgument NonShortCircuitBoolean NullArgumentToVariableArgMethod NumberEquality ObjectEquality ObjectEqualsNull ObjectToString PrimitiveArrayArgumentToVariableArgMethod ReflectionForUnavailableAnnotation ReplaceAllDot ResultOfObjectAllocationIgnored ResultSetIndexZero ReturnNull StaticCallOnSubclass StringConcatenationInFormatCall StringConcatenationInMessageFormatCall StringConcatenationMissingWhitespace StaticFieldReferenceOnSubclass StringEquality SubtractionInCompareTo SuspiciousArrayCast SuspiciousIndentAfterControlStatement SuspiciousSystemArraycopy SuspiciousToArrayCall TextLabelInSwitchStatement ThrowableResultOfMethodCallIgnored UseOfPropertiesAsHashtable VariableNotUsedInsideIf

AnonymousInnerClass ClassInTopLevelPackage ClassInitializer ClassMayBeInterface ClassNameDiffersFromFileName ConstantDeclaredInAbstractClass ConstantDeclaredInInterface EmptyClass FinalClass FinalMethodInFinalClass FinalMethod FinalPrivateMethod FinalStaticMethod InnerClassOnInterface LimitedScopeInnerClass ListenerMayUseAdapter MarkerInterface MissingDeprecatedAnnotation MissingOverrideAnnotation MultipleTopLevelClassesInFile NonFinalFieldInEnum NonFinalUtilityClass NoopMethodInAbstractClass ProtectedMemberInFinalClass PublicConstructor PublicConstructorInNonPublicClass Singleton StaticNonFinalField UtilityClass UtilityClassWithPublicConstructor UtilityClassWithoutPrivateConstructor MethodReturnAlwaysConstant

AnonymousClassComplexity AnonymousClassMethodCount ClassComplexity ClassCoupling ClassInheritanceDepth ClassNestingDepth ConstructorCount FieldCount MethodCount

CloneCallsConstructors CloneCallsSuperClone CloneDeclaresCloneNotSupported CloneInNonCloneableClass CloneableImplementsClone

BreakStatement BreakStatementWithLabel ConditionalExpression ConditionalExpressionWithIdenticalBranches ConfusingElse ConstantConditionalExpression ConstantIfStatement ContinueStatement ContinueStatementWithLabel DefaultNotLastCaseInSwitch DoubleNegation DuplicateBooleanBranch DuplicateCondition EnumSwitchStatementWhichMissesCases FallthruInSwitchStatement ForLoopReplaceableByWhile ForLoopWithMissingComponent IfMayBeConditional IfStatementWithIdenticalBranches IfStatementWithTooManyBranches InfiniteLoopStatement LabeledStatement LoopConditionNotUpdatedInsideLoop LoopStatementsThatDontLoop LoopWithImplicitTerminationCondition NegatedConditional NegatedEqualityExpression NegatedIfElse NestedConditionalExpression NestedSwitchStatement OverlyComplexBooleanExpression PointlessBooleanExpression PointlessIndexOfComparison PointlessNullCheck SimplifiableConditionalExpression SwitchStatementDensity SwitchStatement SwitchStatementWithConfusingDeclaration SwitchStatementWithTooFewBranches SwitchStatementWithTooManyBranches SwitchStatementsWithoutDefault TrivialIf UnnecessaryConditionalExpression UnnecessaryContinue UnnecessaryDefault UnnecessaryLabelOnBreakStatement UnnecessaryLabelOnContinueStatement UnnecessaryReturn

BooleanVariableAlwaysNegated ConstantValueVariableUse LawOfDemeter OrredNotEqualExpression ReuseOfLocalVariable TooBroadScope UnnecessaryLocalVariable BooleanMethodIsAlwaysInverted

ClassWithTooManyDependencies ClassWithTooManyDependents ClassWithTooManyTransitiveDependencies ClassWithTooManyTransitiveDependents CyclicClassDependency CyclicPackageDependency

PackageVisibleField PackageVisibleInnerClass ProtectedField ProtectedInnerClass PublicField PublicInnerClass ReturnOfCollectionField ReturnOfDateField UseOfAnotherObjectsPrivateField

BadExceptionCaught BadExceptionDeclared BadExceptionThrown CaughtExceptionImmediatelyRethrown CheckedExceptionClass ContinueOrBreakFromFinallyBlock EmptyCatchBlock EmptyFinallyBlock EmptyTryBlock ErrorRethrown ExceptionFromCatchWhichDoesntWrap FinallyBlockCannotCompleteNormally InstanceofCatchParameter NestedTryStatement NonFinalFieldOfException ReturnFromFinallyBlock ThreadDeathRethrown ThrowCaughtLocally ThrowFromFinallyBlock NullThrown TooBroadCatch TooBroadThrows UncheckedExceptionClass UnusedCatchParameter NewExceptionWithoutArguments ThrowsRuntimeException

FinalizeCallsSuperFinalize Finalize FinalizeNotProtected NoExplicitFinalizeCalls

JavaLangImport PreconditionsCheckNotNullLiteral OnDemandImport RedundantImport SamePackageImport SingleClassImport StaticImport UnusedImport

AbstractClassExtendsConcreteClass AbstractClassNeverImplemented AbstractClassWithoutAbstractMethods AbstractMethodOverridesAbstractMethod AbstractMethodOverridesConcreteMethod AbstractMethodWithMissingImplementations ExtendsAnnotation ExtendsConcreteCollection ExtendsUtilityClass InterfaceNeverImplemented NonProtectedConstructorInAbstractClass RedundantMethodOverride RefusedBequest StaticInheritance TypeParameterExtendsFinalClass

AbstractMethodCallInConstructor InstanceVariableInitialization InstanceVariableUninitializedUse NonFinalStaticVariableUsedInClassInitialization NonThreadSafeLazyInitialization OverridableMethodCallDuringObjectConstruction OverriddenMethodCallDuringObjectConstruction StaticVariableInitialization StaticVariableUninitializedUse ThisEscapedInConstructor

CharacterComparison DateToString MagicCharacter NumericToString SimpleDateFormatWithoutLocale StringCompareTo StringConcatenation StringEqualsIgnoreCase StringEquals StringToUpperWithoutLocale StringTokenizer TimeToString AbsoluteAlignmentInUserInterface

AbstractClassWithOnlyOneDirectInheritor AnonymousInnerClassMayBeStatic ArrayLengthInLoopCondition CheckForOutOfMemoryOnLargeArrayAllocation ConnectionResource FieldRepeatedlyAccessed InterfaceWithOnlyOneDirectInheritor MethodCallInLoopCondition MultiplyOrDivideByPowerOfTwo OverlyLargePrimitiveArrayInitializer PrivateMemberAccessBetweenOuterAndInnerClass RecordStoreResource SimplifiableIfStatement SingleCharacterStartsWith

ClassWithoutConstructor ClassWithoutNoArgConstructor FieldHasSetterButNoGetter

HtmlTagCanBeJavadocTag PackageDotHtmlMayBePackageInfo UnnecessaryJavaDocLink UnnecessaryInheritDoc

CollectionsFieldAccessReplaceableByMethodCall EnumerationCanBeIteration ForCanBeForeach IfCanBeSwitch IndexOfReplaceableByContains MethodCanBeVariableArityMethod RawUseOfParameterizedType StringBufferReplaceableByStringBuilder TryFinallyCanBeTryWithResources TryWithIdenticalCatches UnnecessaryBoxing UnnecessaryUnboxing WhileCanBeForeach

AnnotationClass Annotation AssertAsName AssertStatement AutoBoxing AutoUnboxing EnumAsName EnumClass ForeachStatement VarargParameter

AssertEqualsBetweenInconvertibleTypes AssertEqualsMayBeAssertSame AssertEqualsCalledOnArray AssertsWithoutMessages BeforeClassOrAfterClassIsPublicStaticVoidNoArg BeforeOrAfterIsPublicVoidNoArg ExpectedExceptionNeverThrown ParameterizedParametersStaticCollection ConstantJUnitAssertArgument IgnoredJUnitTest JUnit3StyleTestMethodInJUnit4Class JUnit4AnnotatedMethodInJUnit3TestCase JUnitAbstractTestClassNamingConvention JUnitTestClassNamingConvention MisspelledSetUp MisspelledTearDown MisorderedAssertEqualsParameters MultipleExceptionsDeclaredOnTestMethod TestCaseWithConstructor SetupCallsSuperSetup SetupIsPublicVoidNoArg SimplifiableJUnitAssertion StaticSuite TestCaseInProductCode TestCaseWithNoTestMethods TeardownCallsSuperTeardown TeardownIsPublicVoidNoArg TestMethodInProductCode TestMethodIsPublicVoidNoArg TestMethodWithoutAssertion UnconstructableTestCase UseOfObsoleteAssert

ClassWithMultipleLoggers ClassWithoutLogger LoggingConditionDisagreesWithLogStatement LoggerInitializedWithForeignClass LogStatementGuardedByLogCondition NonStaticFinalLogger PublicMethodWithoutLogging StringConcatenationArgumentToLogCall

SuppressionAnnotation SystemOutErr ThrowablePrintStackTrace TodoComment ThreadDumpStack ObsoleteCollection

StaticCollection StringBufferField SystemGC ZeroLengthArrayInitialization

ParametersPerConstructor CyclomaticComplexity MethodCoupling MethodWithMultipleLoops MultipleReturnPointsPerMethod NestingDepth NonCommentSourceStatements ParametersPerMethod ThreeNegationsPerMethod ThrownExceptionsPerMethod

ClassIndependentOfModule ClassOnlyUsedInOneModule ModuleWithTooManyClasses ModuleWithTooFewClasses

AnnotationNamingConvention BooleanMethodNameMustStartWithQuestion ClassNamePrefixedWithPackageName ClassNameSameAsAncestorName ClassNamingConvention ConfusingMainMethod ConstantNamingConvention DollarSignInName EnumeratedClassNamingConvention EnumeratedConstantNamingConvention ExceptionNameDoesntEndWithException InstanceMethodNamingConvention InstanceVariableNamingConvention InterfaceNamingConvention LocalVariableNamingConvention MethodNameSameAsClassName MethodNameSameAsParentName MethodNamesDifferOnlyByCase NonBooleanMethodNameMayNotStartWithQuestion NonExceptionNameEndsWithException OverloadedMethodsWithSameNumberOfParameters OverloadedVarargsMethod PackageNamingConvention ParameterNameDiffersFromOverriddenParameter ParameterNamingConvention QuestionableName StandardVariableNames StaticMethodNamingConvention StaticVariableNamingConvention TypeParameterNamingConvention UpperCaseFieldNameNotConstant

BadOddness BigDecimalEquals CachedNumberConstructorCall CastThatLosesPrecision CharUsedInArithmeticContext ComparisonOfShortAndChar ComparisonToNaN ConfusingFloatingPointLiteral ConstantMathCall DivideByZero DoubleLiteralMayBeFloatLiteral FloatingPointEquality ImplicitNumericConversion IntegerDivisionInFloatingPointContext IntegerMultiplicationImplicitCastToLong IntLiteralMayBeLongLiteral LongLiteralsEndingWithLowercaseL NonReproducibleMathCall OctalLiteral OctalAndDecimalIntegersMixed OverlyComplexArithmeticExpression PointlessArithmeticExpression UnaryPlus UnnecessaryExplicitNumericCast UnnecessaryUnaryMinus UnpredictableBigDecimalConstructorCall

ClassOnlyUsedInOnePackage ClassUnconnectedToPackage DisjointPackage EmptyDirectory PackageInMultipleModules PackageWithTooManyClasses PackageWithTooFewClasses

ArraysAsListWithZeroOrOneArgument BooleanConstructor CallToSimpleGetterInClass CallToSimpleSetterInClass CollectionContainsUrl CollectionsMustHaveInitialCapacity ConstantStringIntern DynamicRegexReplaceableByCompiledPattern EqualsHashCodeCalledOnUrl FieldMayBeStatic InnerClassMayBeStatic InstantiatingObjectToGetClassObject JavaLangReflect KeySetIterationMayUseEntrySet LengthOneStringInIndexOf LengthOneStringsInConcatenation ManualArrayToCollectionCopy ManualArrayCopy MapReplaceableByEnumMap MethodMayBeStatic ClassInitializerMayBeStatic ObjectAllocationInLoop RandomDoubleForRandomInteger RedundantStringFormatCall SetReplaceableByEnumSet StringBufferMustHaveInitialCapacity StringBufferToStringInConcatenation StringConcatenationInLoops StringConcatenationInsideStringBufferAppend StringConstructor StringEqualsEmptyString StringReplaceableByStringBuffer StringToString SubstringZero TailRecursion ToArrayCallWithZeroLengthArrayArgument TrivialStringConcatenation UnnecessaryTemporaryOnConversionToString UnnecessaryTemporaryOnConversionFromString BoxingBoxedValue

HardcodedFileSeparators HardcodedLineSeparators NativeMethods RuntimeExec SystemExit SystemGetenv UseOfAWTPeerClass UseOfJDBCDriverClass UseOfProcessBuilder UseOfSunClasses

ElementOnlyUsedFromTestCode UnusedLabel

ChannelResource DriverManagerGetConnection HibernateResource IOResource JDBCResource JNDIResource SocketResource

ClassLoaderInstantiation CloneableClassInSecureContext CustomClassloader CustomSecurityManager DeserializableClassInSecureContext DesignForExtension JDBCExecuteWithNonConstantString JDBCPrepareStatementWithNonConstantString LoadLibraryWithNonConstantString NonFinalClone NonStaticInnerClassInSecureContext PublicStaticArrayField PublicStaticCollectionField RuntimeExecWithNonConstantString SerializableClassInSecureContext SystemSetSecurityManager SystemProperties UnsecureRandomNumberGeneration

ComparatorNotSerializable ExternalizableWithoutPublicNoArgConstructor ExternalizableWithSerializationMethods NonSerializableFieldInSerializableClass NonSerializableObjectBoundToHttpSession NonSerializableObjectPassedToObjectStream NonSerializableWithSerialVersionUIDField NonSerializableWithSerializationMethods ReadObjectAndWriteObjectPrivate ReadObjectInitialization ReadResolveAndWriteReplaceProtected SerialPersistentFieldsWithWrongSignature SerialVersionUIDNotStaticFinal SerializableHasSerialVersionUIDField SerializableHasSerializationMethods SerializableInnerClassHasSerialVersionUIDField SerializableInnerClassWithNonSerializableOuterClass SerializableWithUnconstructableAncestor TransientFieldInNonSerializableClass TransientFieldNotInitialized

CallToStringConcatCanBeReplacedByOperator CStyleArrayDeclaration ChainedEquality ChainedMethodCall ConfusingOctalEscape ConstantOnLHSOfComparison ConstantOnRHSOfComparison ControlFlowStatementWithoutBraces EqualsCalledOnEnumConstant ExtendsObject FieldMayBeFinal ImplicitCallToSuper ListIndexOfReplaceableByContains LiteralAsArgToStringEquals MissortedModifiers MultipleDeclaration MultipleTypedDeclaration UnnecessaryConstantArrayCreationExpression NestedMethodCall RedundantFieldInitialization RedundantImplements ReturnThis SimplifiableAnnotation SimplifiableEqualsExpression StringBufferReplaceableByString TypeParameterExtendsObject UnnecessarilyQualifiedInnerClassAccess UnnecessarilyQualifiedStaticUsage UnnecessaryBlockStatement UnnecessaryCallToStringValueOf UnnecessaryConstructor UnnecessaryEnumModifier UnnecessaryFinalOnLocalVariableOrParameter UnnecessaryFullyQualifiedName UnnecessaryInterfaceModifier UnnecessaryParentheses UnnecessarilyQualifiedStaticallyImportedElement UnnecessaryQualifierForThis UnnecessarySemicolon UnnecessarySuperConstructor UnnecessarySuperQualifier UnnecessaryThis UnqualifiedFieldAccess UnqualifiedMethodAccess UnqualifiedInnerClassAccess UnqualifiedStaticUsage UnclearBinaryExpression SizeReplaceableByIsEmpty

AccessToNonThreadSafeStaticFieldFromInstance AccessToStaticFieldLockedOnInstance AwaitNotInLoop AwaitWithoutCorrespondingSignal BusyWait CallToNativeMethodWhileLocked ConditionSignal DoubleCheckedLocking EmptySynchronizedStatement ExtendsThread FieldAccessedSynchronizedAndUnsynchronized MethodMayBeSynchronized NakedNotify NestedSynchronizedStatement NonAtomicOperationOnVolatileField NonSynchronizedMethodOverridesSynchronizedMethod NotifyCalledOnCondition NotifyNotInSynchronizedContext NotifyWithoutCorrespondingWait ObjectNotify PublicFieldAccessedInSynchronizedContext SafeLock SignalWithoutCorrespondingAwait SleepWhileHoldingLock SynchronizationOnLocalVariableOrMethodParameter SynchronizationOnStaticField SynchronizeOnLock SynchronizeOnNonFinalField SynchronizedOnLiteralObject SynchronizeOnThis SynchronizedMethod SystemRunFinalizersOnExit ThreadLocalNotStaticFinal ThreadPriority ThreadRun ThreadStartInConstruction ThreadStopSuspendResume ThreadWithDefaultRunMethod ThreadYield UnconditionalWait VolatileArrayField VolatileLongOrDoubleField WaitCalledOnCondition WaitNotInLoop WaitNotInSynchronizedContext WaitOrAwaitWithoutTimeout WaitWhileHoldingTwoLocks WaitWithoutCorrespondingNotify WhileLoopSpinsOnField

AmbiguousMethodCall AmbiguousFieldAccess AnonymousClassVariableHidesContainingMethodVariable ClassEscapesItsScope FieldHidesSuperclassField InnerClassVariableHidesOuterClassVariable LocalVariableHidingMemberVariable MethodOverridesPackageLocalMethod MethodOverloadsParentMethod MethodOverridesPrivateMethod MethodOverridesStaticMethod TypeParameterHidesVisibleType ParameterHidingMemberVariable

cushon commented 10 years ago

Original comment posted by eaftan@google.com on 2013-03-01 at 11:21 PM


We should also look at Eclipse and the Sonar Source project (http://www.sonarsource.org/).

cushon commented 10 years ago

Original comment posted by eaftan@google.com on 2013-03-01 at 11:21 PM


Issue #89 has been merged into this issue.