FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Variables/UnusedParameter.ql at codeql-cli/v2.26.3 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
461
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Variables
/
UnusedParameter.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (36 loc) · 1.05 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Variables
/
UnusedParameter.ql
Copy path
File metadata and controls
40 lines (36 loc) · 1.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @name Unused parameter
* @description Parameter is defined but not used
* @kind problem
* @tags quality
* reliability
* correctness
* readability
* @problem.severity recommendation
* @sub-severity high
* @precision medium
* @id py/unused-parameter
*/
import
python
import
Definition
private
import
LegacyPointsTo
predicate
unused_parameter
(
FunctionValue
f
,
LocalVariable
v
)
{
v
.
isParameter
(
)
and
v
.
getScope
(
)
=
f
.
getScope
(
)
and
not
name_acceptable_for_unused_variable
(
v
)
and
not
exists
(
NameNode
u
|
u
.
uses
(
v
)
)
and
not
exists
(
Name
inner
,
LocalVariable
iv
|
inner
.
uses
(
iv
)
and
iv
.
getId
(
)
=
v
.
getId
(
)
and
inner
.
getScope
(
)
.
getScope
(
)
=
v
.
getScope
(
)
)
}
predicate
is_abstract
(
FunctionValue
func
)
{
func
.
getScope
(
)
.
getADecorator
(
)
.
(
Name
)
.
getId
(
)
.
matches
(
"%abstract%"
)
}
from
PythonFunctionValue
f
,
LocalVariable
v
where
v
.
getId
(
)
!=
"self"
and
unused_parameter
(
f
,
v
)
and
not
f
.
isOverridingMethod
(
)
and
not
f
.
isOverriddenMethod
(
)
and
not
is_abstract
(
f
)
select
f
,
"The parameter '"
+
v
.
getId
(
)
+
"' is never used."
Back
|
FazBrowse Home
|
New Git URL