# Package groovy.org.codenarc.rule.basic

- Class Summary
  Class | Description
  --- | ---
  AbstractFinallyAstVisitor | Abstract superclass for AST Visitor classes that check for conditions within a finally block
  AssertWithinFinallyBlockAstVisitor |
  AssertWithinFinallyBlockRule | Rule that checks for assert statements within a finally block.
  AssignmentInConditionalAstVisitor |
  AssignmentInConditionalRule | An assignment operator (=) was used in a conditional test.
  BigDecimalInstantiationAstVisitor |
  BigDecimalInstantiationRule | Rule that checks for calls to the BigDecimal constructor with a double or float literal.
  BitwiseOperatorInConditionalAstVisitor |
  BitwiseOperatorInConditionalRule | Checks for bitwise operations in conditionals, if you need to do a bitwise operation then it is best practive to extract a temp variable.
  BooleanGetBooleanAstVisitor |
  BooleanGetBooleanRule | This rule catches usages of java.lang.Boolean.getBoolean(String) which reads a boolean from the System properties.
  BrokenNullCheckAstVisitor |
  BrokenNullCheckRule | Looks for faulty checks for null in boolean conditions, e.g.
  BrokenOddnessCheckAstVisitor |
  BrokenOddnessCheckRule | The code uses x % 2 == 1 to check to see if a value is odd, but this won't work for negative numbers (e.g., (-5) % 2 == -1).
  ClassForNameAstVisitor |
  ClassForNameRule | Using Class.forName(...) is a common way to add dynamic behavior to a system.
  ComparisonOfTwoConstantsAstVisitor |
  ComparisonOfTwoConstantsRule | CodeNarc Rule.
  ComparisonWithSelfAstVisitor |
  ComparisonWithSelfRule | CodeNarc Rule.
  ConstantAssertExpressionAstVisitor |

  ConstantAssertExpressionRule

  Rule that checks for assert statements where the assert condition expressions is a constant value or literal value, such as:
  - `assert true`
  - `assert false`
  - `assert Boolean.TRUE`
  - `assert Boolean.FALSE`
  - `assert null`
  - `assert 0`
  - `assert 99.7`
  - `assert ""`
  - `assert "abc"`
  - `assert [:]`
  - `assert [a:123, b:456]`
  - `assert [a, b, c]`

  ConstantIfExpressionAstVisitor |

  ConstantIfExpressionRule

  Rule that checks for if statement with a constant value for the if expression, such as:
  - `if (true) { .. }`
  - `if (false) { .. }`
  - `if (Boolean.TRUE) { .. }`
  - `if (Boolean.FALSE) { .. }`
  - `if (null) { .. }`
  - `if (0) { .. }`
  - `if (99.7) { .. }`
  - `if ("") { .. }`
  - `if ("abc") { .. }`
  - `if ([a:123, b:456]) { .. }`
  - `if ([a, b]) { .. }`

  ConstantTernaryExpressionAstVisitor |

  ConstantTernaryExpressionRule

  Rule that checks for ternary expressions with a constant value for the boolean expression, such as:
  - `true ?`

  DeadCodeAstVisitor |
  DeadCodeRule | Dead code appears after a return statement or an exception is thrown.
  DoubleNegativeAstVisitor |
  DoubleNegativeRule | There is no point in using a double negative, it is always positive.
  DuplicateCaseStatementAstVisitor |
  DuplicateCaseStatementRule | Rule that checks for duplicate case statements in a switch block, such as two equal integers or strings.
  DuplicateMapKeyAstVisitor |
  DuplicateMapKeyRule | A map literal is created with duplicated key.
  DuplicateSetValueAstVisitor |
  DuplicateSetValueRule | A Set literal is created with duplicate constant value.
  EmptyCatchBlockAstVisitor |
  EmptyCatchBlockRule | Rule that checks for empty catch blocks
  EmptyClassRule | Reports classes without methods, fields or properties.
  EmptyElseBlockAstVisitor |
  EmptyElseBlockRule | Rule that checks for empty else blocks
  EmptyFinallyBlockAstVisitor |
  EmptyFinallyBlockRule | Rule that checks for empty finally blocks
  EmptyForStatementAstVisitor |
  EmptyForStatementRule | Rule that checks for empty for statements
  EmptyIfStatementAstVisitor |
  EmptyIfStatementRule | Rule that checks for empty if statements
  EmptyInstanceInitializerAstVisitor |
  EmptyInstanceInitializerRule | The class has an empty instance initializer.
  EmptyMethodAstVisitor |
  EmptyMethodRule | A method was found without an implementation.
  EmptyStaticInitializerAstVisitor |
  EmptyStaticInitializerRule | An empty static initializer was found.
  EmptySwitchStatementAstVisitor |
  EmptySwitchStatementRule | Rule that checks for empty switch statements
  EmptySynchronizedStatementAstVisitor |
  EmptySynchronizedStatementRule | Rule that checks for empty synchronized statement
  EmptyTryBlockAstVisitor |
  EmptyTryBlockRule | Rule that checks for empty try blocks
  EmptyWhileStatementAstVisitor |
  EmptyWhileStatementRule | Rule that checks for empty while statements
  EqualsAndHashCodeAstVisitor |
  EqualsAndHashCodeRule | Rule that checks that if either the `boolean equals(Object)` or the `int hashCode()` methods are overridden within a class, then both must be overridden.
  EqualsOverloadedAstVisitor |
  EqualsOverloadedRule | The class has an equals method, but the parameter of the method is not of type Object.
  ExplicitGarbageCollectionAstVisitor |
  ExplicitGarbageCollectionRule | Calls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised.
  ForLoopShouldBeWhileLoopAstVisitor |
  ForLoopShouldBeWhileLoopRule | For loops where init and update statements are empty can be simplified to while loops.
  HardCodedWindowsFileSeparatorAstVisitor |
  HardCodedWindowsFileSeparatorRule | This rule finds usages of a Windows file separator within the constructor call of a File object.
  HardCodedWindowsRootDirectoryRule | This rule find cases where a File object is constructed with a windows-based path.
  HardcodedWindowsRootDirectoryAstVisitor |
  IntegerGetIntegerAstVisitor |
  IntegerGetIntegerRule | This rule catches usages of java.lang.Integer.getInteger(String, ...) which reads an Integer from the System properties.
  MathRandomTracker |
  MultipleUnaryOperatorsAstVisitor |
  MultipleUnaryOperatorsRule | Checks for multiple consecutive unary operators.
  RandomDoubleCoercedToZeroAstVisitor |
  RandomDoubleCoercedToZeroRule | The Math.random() method returns a double result greater than or equal to 0.0 and less than 1.0.
  RemoveAllOnSelfAstVisitor |
  RemoveAllOnSelfRule | This rule catches calling the method removeAll with yourself as a parameter.
  ReturnFromFinallyBlockAstVisitor |
  ReturnFromFinallyBlockRule | Rule that checks for a return from within a finally block
  ThrowExceptionFromFinallyBlockAstVisitor |
  ThrowExceptionFromFinallyBlockRule | Rule that checks for throwing an exception from within a finally block