Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34f9135

Browse files
committed
Python: Modernise py/unused-parameter
1 parent 15bc4cd commit 34f9135

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

python/ql/src/Variables/UnusedParameter.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ import python
1313
import Definition
1414

1515

16-
predicate unused_parameter(FunctionObject f, LocalVariable v) {
16+
predicate unused_parameter(FunctionValue f, LocalVariable v) {
1717
v.isParameter() and
18-
v.getScope() = f.getFunction() and
18+
v.getScope() = f.getScope() and
1919
not name_acceptable_for_unused_variable(v) and
2020
not exists(NameNode u | u.uses(v)) and
2121
not exists(Name inner, LocalVariable iv | inner.uses(iv) and iv.getId() = v.getId() and inner.getScope().getScope() = v.getScope())
2222
}
2323

24-
predicate is_abstract(FunctionObject func) {
25-
((Name)func.getFunction().getADecorator()).getId().matches("%abstract%")
24+
predicate is_abstract(FunctionValue func) {
25+
func.getScope().getADecorator().(Name).getId().matches("%abstract%")
2626
}
2727

28-
from PyFunctionObject f, LocalVariable v
28+
from PythonFunctionValue f, LocalVariable v
2929
where v.getId() != "self" and unused_parameter(f, v) and not f.isOverridingMethod() and not f.isOverriddenMethod() and
3030
not is_abstract(f)
3131
select f, "The parameter '" + v.getId() + "' is never used."

0 commit comments

Comments
 (0)