facebook pixelJava Static Analysis Rules
BACK TO LIST

Java rules

The Codiga Code Analysis engine supports hundreds of rules for Java, checking that your code is safe and secure. Start using Codiga today to check your code and automate your code reviews to find issues in every pull request and merge with confidence.

      AssignmentToNonFinalStatic

      Error prone
      Medium

      Possible unsafe assignment to a non-final static field in a constructor.

      Learn more

      AvoidDecimalLiteralsInBigDecimalConstructor

      Error prone
      Medium

      Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal

      AvoidInstanceofChecksInCatchClause

      Error prone
      Medium

      An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type.

      AvoidUsingOctalValues

      Error prone
      Medium

      Do not start a literal by 0 unless its an octal value

      BadComparison

      Error prone
      Medium

      Avoid equality comparisons with Double.NaN

      CheckSkipResult

      Error prone
      Medium

      Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped.

      ClassCastExceptionWithToArray

      Error prone
      Medium

      This usage of the Collection.toArray() method will throw a ClassCastException.

      CloseResource

      Error prone
      Medium

      Ensure that resources like this PipedWriter object are closed after use

      CompareObjectsWithEquals

      Error prone
      Medium

      Use equals() to compare object references.

      DontUseFloatTypeForLoopIndices

      Error prone
      Medium

      Dont use floating point for loop indices. If you must use floating point

      IdempotentOperations

      Error prone
      Medium

      Avoid idempotent operations (like assigning a variable to itself).

      JumbledIncrementer

      Error prone
      Medium

      Avoid modifying an outer loop incrementer in an inner loop for update expression

      MisplacedNullCheck

      Error prone
      Medium

      The null check here is misplaced; if the variable is null there will be a NullPointerException

      MissingBreakInSwitch

      Error prone
      Medium

      A switch statement does not contain a break

      MissingStaticMethodInNonInstantiatableClass

      Error prone
      Medium

      Class cannot be instantiated and does not provide any static methods or fields

      NonCaseLabelInSwitchStatement

      Error prone
      Medium

      A non-case label was present in a switch statement

      NonStaticInitializer

      Error prone
      Medium

      Non-static initializers are confusing

      OverrideBothEqualsAndHashcode

      Error prone
      Medium

      Ensure you override both equals() and hashCode()

      ReturnFromFinallyBlock

      Error prone
      Medium

      Avoid returning from a finally block

      SimpleDateFormatNeedsLocale

      Error prone
      Medium

      When instantiating a SimpleDateFormat object

      UnconditionalIfStatement

      Error prone
      Medium

      Do not use if statements that are always true or always false

      UseLocaleWithCaseConversions

      Error prone
      Medium

      Use explicit locale when doing a String.toLowerCase()/toUpperCase() call