Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow static import of BugCheckerRefasctoringTestHelper.TestMode#TEXT_MATCH #862

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public final class NonStaticImport extends BugChecker implements CompilationUnit
*/
@VisibleForTesting
static final ImmutableSet<String> NON_STATIC_IMPORT_CANDIDATE_TYPES =
ImmutableSet.of("com.google.common.base.Strings", "java.time.Clock", "java.time.ZoneOffset");
ImmutableSet.of(
"com.google.common.base.Strings",
"com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode",
"java.time.Clock",
"java.time.ZoneOffset");

/**
* Type members that should never be statically imported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static com.google.common.collect.ImmutableListMultimap.toImmutableListMultimap;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH;
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
import static java.util.Comparator.naturalOrder;
import static tech.picnic.errorprone.refaster.runner.Refaster.INCLUDED_RULES_PATTERN_FLAG;
Expand All @@ -19,6 +18,7 @@
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.SubContext;
Expand Down Expand Up @@ -126,7 +126,7 @@
.setArgs(ImmutableList.of("-XepOpt:" + RULE_COLLECTION_FLAG + '=' + className))
.addInput(className + "TestInput.java")
.addOutput(className + "TestOutput.java")
.doTest(TEXT_MATCH);
.doTest(TestMode.TEXT_MATCH);

Check warning on line 129 in refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java

View workflow job for this annotation

GitHub Actions / pitest

A change can be made to line 129 without causing a test to fail

removed call to com/google/errorprone/BugCheckerRefactoringTestHelper::doTest (covered by 7 tests VoidMethodCallMutator)
}

@Override
Expand Down