Skip to content

Commit 5fea31e

Browse files
committed
Python: Moves predicates over to suffixed form
1 parent e39a0c9 commit 5fea31e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

python/ql/src/Exceptions/EmptyExcept.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ predicate subscript(Stmt s) {
6464
s.(Delete).getATarget() instanceof Subscript
6565
}
6666

67-
predicate encode_decode(Expr ex, ClassObject type) {
67+
predicate encode_decode_objectapi(Expr ex, ClassObject type) {
6868
exists(string name |
6969
ex.(Call).getFunc().(Attribute).getName() = name |
7070
name = "encode" and type = Object::builtin("UnicodeEncodeError")
@@ -73,7 +73,7 @@ predicate encode_decode(Expr ex, ClassObject type) {
7373
)
7474
}
7575

76-
predicate small_handler(ExceptStmt ex, Stmt s, ClassObject type) {
76+
predicate small_handler_objectapi(ExceptStmt ex, Stmt s, ClassObject type) {
7777
not exists(ex.getTry().getStmt(1)) and
7878
s = ex.getTry().getStmt(0) and
7979
ex.getType().refersTo(type)
@@ -82,16 +82,16 @@ predicate small_handler(ExceptStmt ex, Stmt s, ClassObject type) {
8282
/** Holds if this exception handler is sufficiently small in scope to not need a comment
8383
* as to what it is doing.
8484
*/
85-
predicate focussed_handler(ExceptStmt ex) {
85+
predicate focussed_handler_objectapi(ExceptStmt ex) {
8686
exists(Stmt s, ClassObject type |
87-
small_handler(ex, s, type) |
87+
small_handler_objectapi(ex, s, type) |
8888
subscript(s) and type.getAnImproperSuperType() = theLookupErrorType()
8989
or
9090
attribute_access(s) and type = theAttributeErrorType()
9191
or
9292
s.(ExprStmt).getValue() instanceof Name and type = theNameErrorType()
9393
or
94-
encode_decode(s.(ExprStmt).getValue(), type)
94+
encode_decode_objectapi(s.(ExprStmt).getValue(), type)
9595
)
9696
}
9797

@@ -102,5 +102,5 @@ Try try_return() {
102102
from ExceptStmt ex
103103
where empty_except(ex) and no_else(ex) and no_comment(ex) and not non_local_control_flow(ex)
104104
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)
106106
select ex, "'except' clause does nothing but pass and there is no explanatory comment."

0 commit comments

Comments
 (0)