Skip to content

Commit

Permalink
Remove the underscore heuristic flag.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 583995107
  • Loading branch information
graememorgan authored and Error Prone Team committed Nov 20, 2023
1 parent 7684e85 commit b0b0b67
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

import com.google.common.collect.ImmutableSet;
import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker.ClassTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
Expand All @@ -57,7 +56,6 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.inject.Inject;
import javax.lang.model.element.Modifier;

/**
Expand Down Expand Up @@ -97,14 +95,6 @@ private static boolean isParameterAnnotation(AnnotationTree annotation, VisitorS

private static final Matcher<Tree> NOT_STATIC = not(hasModifier(STATIC));

private final boolean underscoreHeuristic;

@Inject
JUnit4TestNotRun(ErrorProneFlags flags) {
this.underscoreHeuristic =
flags.getBoolean("JUnit4TestNotRun:UnderscoreHeuristic").orElse(true);
}

@Override
public Description matchClass(ClassTree tree, VisitorState state) {
if (!isJUnit4TestClass.matches(tree, state)) {
Expand Down Expand Up @@ -170,7 +160,7 @@ private Optional<Description> handleMethod(MethodTree methodTree, VisitorState s
}

// Method name contains underscores: it's either a test or a style violation.
if (underscoreHeuristic && methodTree.getName().toString().contains("_")) {
if (methodTree.getName().toString().contains("_")) {
return Optional.of(describeFixes(methodTree, state));
}

Expand Down

0 comments on commit b0b0b67

Please sign in to comment.