@@ -32,30 +32,33 @@ where
3232 container .getMember ( name ) = member and
3333 isSuspisousMethodName ( name , container ) and
3434
35- // Assume that a "new" method is intentional if the class has an explicit constructor .
35+ // Cases to ignore .
3636 not (
37- name = "new" and
38- container instanceof ClassDefinition and
39- not container .getMember ( "constructor" ) .( ConstructorDeclaration ) .isSynthetic ( )
40- ) and
41-
42- // Explicitly declared static methods are fine.
43- not (
44- container instanceof ClassDefinition and
45- member .isStatic ( )
46- ) and
47-
48- // Only looking for declared methods. Methods with a body are OK.
49- not exists ( member .getBody ( ) .getBody ( ) ) and
50-
51- // The developer was not confused about "function" when there are other methods in the interface.
52- not (
53- name = "function" and
54- exists ( MethodDeclaration other | other = container .getAMethod ( ) |
55- name != "function" and
56- not other .( ConstructorDeclaration ) .isSynthetic ( )
37+ ( // Assume that a "new" method is intentional if the class has an explicit constructor.
38+ name = "new" and
39+ container instanceof ClassDefinition and
40+ not container .getMember ( "constructor" ) .( ConstructorDeclaration ) .isSynthetic ( )
41+ )
42+ or
43+ ( // Explicitly declared static methods are fine.
44+ container instanceof ClassDefinition and
45+ member .isStatic ( )
5746 )
58- ) and
47+ or
48+ // Only looking for declared methods. Methods with a body are OK.
49+ exists ( member .getBody ( ) .getBody ( ) )
50+
51+ or
52+ ( // The developer was not confused about "function" when there are other methods in the interface.
53+ name = "function" and
54+ exists ( MethodDeclaration other | other = container .getAMethod ( ) |
55+ name != "function" and
56+ not other .( ConstructorDeclaration ) .isSynthetic ( )
57+ )
58+ )
59+ )
60+
61+ and
5962
6063 (
6164 name = "constructor" and msg = "The member name 'constructor' does not declare a constructor in interface declarations, but it does in class declarations."
0 commit comments