4242public class NotDiscoverableTestMethodCheck extends PythonSubscriptionCheck {
4343
4444 private static final String MESSAGE = "Rename this method so that it starts with \" test\" or remove this unused helper." ;
45- private static final Set <String > globalFixture = new HashSet <>();
45+ private final Set <String > globalFixture = new HashSet <>();
4646
4747 @ Override
4848 public void initialize (Context context ) {
49- context .registerSyntaxNodeConsumer (Tree .Kind .FUNCDEF , ctx -> NotDiscoverableTestMethodCheck . lookForGlobalFixture ((FunctionDef ) ctx .syntaxNode ()));
49+ context .registerSyntaxNodeConsumer (Tree .Kind .FUNCDEF , ctx -> lookForGlobalFixture ((FunctionDef ) ctx .syntaxNode ()));
5050
5151 context .registerSyntaxNodeConsumer (Tree .Kind .CLASSDEF , ctx -> {
5252 ClassDef classDefinition = (ClassDef ) ctx .syntaxNode ();
@@ -73,7 +73,7 @@ public void initialize(Context context) {
7373 });
7474 }
7575
76- private static void lookForGlobalFixture (FunctionDef functionDef ) {
76+ private void lookForGlobalFixture (FunctionDef functionDef ) {
7777 if (functionDef .isMethodDefinition ()) {
7878 return ;
7979 }
@@ -97,7 +97,7 @@ private static Set<String> getFixturesFromClass(ClassDef classDefinition) {
9797 .collect (Collectors .toSet ());
9898 }
9999
100- private static boolean isException (FunctionDef functionDef , Set <String > classFixtures ) {
100+ private boolean isException (FunctionDef functionDef , Set <String > classFixtures ) {
101101 String functionName = functionDef .name ().name ();
102102 return overrideExistingMethod (functionName ) || functionName .startsWith ("test" ) || isHelper (functionDef , classFixtures );
103103 }
@@ -127,7 +127,7 @@ private static boolean overrideExistingMethod(String functionName) {
127127 return UnittestUtils .allMethods ().contains (functionName ) || functionName .startsWith ("_" );
128128 }
129129
130- private static boolean isHelper (FunctionDef functionDef , Set <String > currentClassFixture ) {
130+ private boolean isHelper (FunctionDef functionDef , Set <String > currentClassFixture ) {
131131 return Optional .ofNullable (TreeUtils .getFunctionSymbolFromDef (functionDef )).stream ()
132132 .anyMatch (functionSymbol -> functionSymbol .hasDecorators () || !functionSymbol .parameters ().stream ()
133133 .map (FunctionSymbol .Parameter ::name )
0 commit comments