Java Test Code: 40 more rules enabled by default

First batch:

  • S1130 - Exceptions in “throws” clauses should not be superfluous
  • S1874 - “@Deprecated” code should not be used
  • S6126 - String multiline concatenation should be replaced with Text Blocks
  • S6208 - Comma-separated labels should be used in Switch with colon case
  • S1117 - Local variables should not shadow class fields
  • S1134 - Track uses of “FIXME” tags
  • S125 - Sections of code should not be commented out
  • S5738 - “@Deprecated” code marked for removal should never be used
  • S1128 - Unnecessary imports should be removed
  • S1135 - Track uses of “TODO” tags
  • S1144 - Unused “private” methods should be removed
  • S6213 - Restricted Identifiers should not be used as Identifiers
  • S3457 - Format strings should be used correctly
  • S1481 - Unused local variables should be removed
  • S1854 - Unused assignments should be removed
  • S1172 - Unused method parameters should be removed
  • S4738 - Java features should be preferred to Guava
  • S4144 - Methods should not have identical implementations
  • S1066 - Mergeable “if” statements should be combined

Second batch:

  • S117 - Local variable and method parameter names should comply with a naming convention
  • S115 - Constant names should comply with a naming convention
  • S116 - Field names should comply with a naming convention
  • S3008 - Static non-final field names should comply with a naming convention
  • S119 - Type parameter names should comply with a naming convention
  • S114 - Interface names should comply with a naming convention
  • S1223 - Non-constructor methods should not have the same name as the enclosing class
  • S1186 - Methods should not be empty
  • S108 - Nested blocks of code should not be left empty
  • S1116 - Empty statements should be removed
  • S128 - Switch cases should end with an unconditional “break” statement
  • S1161 - “@Override” should be used on overriding and implementing methods
  • S1220 - The default unnamed package should not be used
  • S1598 - Package declaration should match source file directory
  • S1197 - Array designators “[” and “]” should be on the type, not the variable
  • S1068 - Unused “private” fields should be removed
  • S1124 - Modifiers should be declared in the correct order
  • S131 - “switch” statements should have “default” clauses
  • S1110 - Redundant pairs of parentheses should be removed
  • S1488 - Local variables should not be declared and then immediately returned or thrown