Skip to main content Link Search Menu Expand Document (external link)

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

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();
   }

Copyright © 2017-2023 Picnic Technologies BV