BugCheckerRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$).* as compiler argument.

Table of contents
  1. BugCheckerRefactoringTestHelperIdentity
  2. BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged
  3. ConstantsFormat
  4. NameContentEquals

BugCheckerRefactoringTestHelperIdentity

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("BugCheckerRefactoringTestHelperIdentity") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$BugCheckerRefactoringTestHelperIdentity).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<BugCheckerRefactoringTestHelper> testBugCheckerRefactoringTestHelperIdentity() {
   return ImmutableSet.of(
-      BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
-          .setFixChooser(FixChoosers.FIRST),
-      BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
-          .setImportOrder("static-first"));
+      BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass()),
+      BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass()));
 }

BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$BugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 BugCheckerRefactoringTestHelper
     testBugCheckerRefactoringTestHelperAddInputLinesExpectUnchanged() {
   return BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())
       .addInputLines("A.java", "class A {}")
-      .addOutputLines("A.java", "class A {}");
+      .expectUnchanged();
 }

ConstantsFormat

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ConstantsFormat") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$ConstantsFormat).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testConstantsFormat() {
-  return String.format("\"%s\"", Convert.quote("foo"));
+  return Constants.format("foo");
 }

NameContentEquals

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("NameContentEquals") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!BugCheckerRules\$NameContentEquals).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testNameContentEquals() {
   return ImmutableSet.of(
-      ((Name) null).toString().equals("foo".subSequence(0, 1).toString()),
-      ((com.sun.tools.javac.util.Name) null).toString().equals("bar"));
+      ((Name) null).contentEquals("foo".subSequence(0, 1)),
+      ((com.sun.tools.javac.util.Name) null).contentEquals("bar"));
 }

Copyright © 2017-2024 Picnic Technologies BV