Skip to content

Commit f94cf76

Browse files
ignore typing ellipses
1 parent 4f6206e commit f94cf76

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

python/ql/src/Statements/StatementNoEffect.ql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ private ClassDef getAProtocolDef() {
128128
)
129129
}
130130

131+
predicate is_typing_ellipsis(ExprStmt s) {
132+
s.getValue() instanceof Ellipsis and
133+
s.getScope() instanceof Function and
134+
is_only_scope_statement(s) and
135+
(
136+
s.getScope() = getAnOverload()
137+
or
138+
s.getScope().getScope() instanceof Class and
139+
s.getScope().getScope() = getAProtocolDef().getDefinedClass()
140+
)
141+
}
142+
131143
predicate is_notebook(File f) {
132144
exists(Comment c | c.getLocation().getFile() = f |
133145
c.getText().regexpMatch("#\\s*<nbformat>.+</nbformat>\\s*")
@@ -173,5 +185,5 @@ predicate no_effect(Expr e) {
173185
}
174186

175187
from ExprStmt stmt
176-
where no_effect(stmt.getValue())
188+
where no_effect(stmt.getValue()) and not is_typing_ellipsis(stmt)
177189
select stmt, "This statement has no effect."

0 commit comments

Comments
 (0)