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

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

Copyright © 2017-2024 Picnic Technologies BV