@@ -64,7 +64,7 @@ predicate subscript(Stmt s) {
64
64
s .( Delete ) .getATarget ( ) instanceof Subscript
65
65
}
66
66
67
- predicate encode_decode ( Expr ex , ClassObject type ) {
67
+ predicate encode_decode_objectapi ( Expr ex , ClassObject type ) {
68
68
exists ( string name |
69
69
ex .( Call ) .getFunc ( ) .( Attribute ) .getName ( ) = name |
70
70
name = "encode" and type = Object:: builtin ( "UnicodeEncodeError" )
@@ -73,7 +73,7 @@ predicate encode_decode(Expr ex, ClassObject type) {
73
73
)
74
74
}
75
75
76
- predicate small_handler ( ExceptStmt ex , Stmt s , ClassObject type ) {
76
+ predicate small_handler_objectapi ( ExceptStmt ex , Stmt s , ClassObject type ) {
77
77
not exists ( ex .getTry ( ) .getStmt ( 1 ) ) and
78
78
s = ex .getTry ( ) .getStmt ( 0 ) and
79
79
ex .getType ( ) .refersTo ( type )
@@ -82,16 +82,16 @@ predicate small_handler(ExceptStmt ex, Stmt s, ClassObject type) {
82
82
/** Holds if this exception handler is sufficiently small in scope to not need a comment
83
83
* as to what it is doing.
84
84
*/
85
- predicate focussed_handler ( ExceptStmt ex ) {
85
+ predicate focussed_handler_objectapi ( ExceptStmt ex ) {
86
86
exists ( Stmt s , ClassObject type |
87
- small_handler ( ex , s , type ) |
87
+ small_handler_objectapi ( ex , s , type ) |
88
88
subscript ( s ) and type .getAnImproperSuperType ( ) = theLookupErrorType ( )
89
89
or
90
90
attribute_access ( s ) and type = theAttributeErrorType ( )
91
91
or
92
92
s .( ExprStmt ) .getValue ( ) instanceof Name and type = theNameErrorType ( )
93
93
or
94
- encode_decode ( s .( ExprStmt ) .getValue ( ) , type )
94
+ encode_decode_objectapi ( s .( ExprStmt ) .getValue ( ) , type )
95
95
)
96
96
}
97
97
@@ -102,5 +102,5 @@ Try try_return() {
102
102
from ExceptStmt ex
103
103
where empty_except ( ex ) and no_else ( ex ) and no_comment ( ex ) and not non_local_control_flow ( ex )
104
104
and not ex .getTry ( ) = try_return ( ) and try_has_normal_exit ( ex .getTry ( ) ) and
105
- not focussed_handler ( ex )
105
+ not focussed_handler_objectapi ( ex )
106
106
select ex , "'except' clause does nothing but pass and there is no explanatory comment."
0 commit comments