FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Imports/DeprecatedModule.ql at codeql-cli/v2.15.4 · 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
997
Pull requests
455
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
/
Imports
/
DeprecatedModule.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (80 loc) · 2.9 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Imports
/
DeprecatedModule.ql
Copy path
File metadata and controls
85 lines (80 loc) · 2.9 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* @name Import of deprecated module
* @description Import of a deprecated module
* @kind problem
* @tags maintainability
* external/cwe/cwe-477
* @problem.severity warning
* @sub-severity high
* @precision very-high
* @id py/import-deprecated-module
*/
import
python
/**
* Holds if the module `name` was deprecated in Python version `major`.`minor`,
* and module `instead` should be used instead (or `instead = "no replacement"`)
*/
predicate
deprecated_module
(
string
name
,
string
instead
,
int
major
,
int
minor
)
{
name
=
"posixfile"
and
instead
=
"fcntl"
and
major
=
1
and
minor
=
5
or
name
=
"gopherlib"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
5
or
name
=
"rgbimgmodule"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
5
or
name
=
"pre"
and
instead
=
"re"
and
major
=
1
and
minor
=
5
or
name
=
"whrandom"
and
instead
=
"random"
and
major
=
2
and
minor
=
1
or
name
=
"rfc822"
and
instead
=
"email"
and
major
=
2
and
minor
=
3
or
name
=
"mimetools"
and
instead
=
"email"
and
major
=
2
and
minor
=
3
or
name
=
"MimeWriter"
and
instead
=
"email"
and
major
=
2
and
minor
=
3
or
name
=
"mimify"
and
instead
=
"email"
and
major
=
2
and
minor
=
3
or
name
=
"rotor"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
4
or
name
=
"statcache"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
2
or
name
=
"mpz"
and
instead
=
"a third party"
and
major
=
2
and
minor
=
2
or
name
=
"xreadlines"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
3
or
name
=
"multifile"
and
instead
=
"email"
and
major
=
2
and
minor
=
5
or
name
=
"sets"
and
instead
=
"builtins"
and
major
=
2
and
minor
=
6
or
name
=
"buildtools"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
3
or
name
=
"cfmfile"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
4
or
name
=
"macfs"
and
instead
=
"no replacement"
and
major
=
2
and
minor
=
3
or
name
=
"md5"
and
instead
=
"hashlib"
and
major
=
2
and
minor
=
5
or
name
=
"sha"
and
instead
=
"hashlib"
and
major
=
2
and
minor
=
5
}
string
deprecation_message
(
string
mod
)
{
exists
(
int
major
,
int
minor
|
deprecated_module
(
mod
,
_
,
major
,
minor
)
|
result
=
"The "
+
mod
+
" module was deprecated in version "
+
major
.
toString
(
)
+
"."
+
minor
.
toString
(
)
+
"."
)
}
string
replacement_message
(
string
mod
)
{
exists
(
string
instead
|
deprecated_module
(
mod
,
instead
,
_
,
_
)
|
result
=
" Use "
+
instead
+
" module instead."
and
not
instead
=
"no replacement"
or
result
=
""
and
instead
=
"no replacement"
)
}
from
ImportExpr
imp
,
string
name
,
string
instead
where
name
=
imp
.
getName
(
)
and
deprecated_module
(
name
,
instead
,
_
,
_
)
and
not
exists
(
Try
try
,
ExceptStmt
except
|
except
=
try
.
getAHandler
(
)
|
except
.
getType
(
)
.
pointsTo
(
ClassValue
::
importError
(
)
)
and
except
.
containsInScope
(
imp
)
)
select
imp
,
deprecation_message
(
name
)
+
replacement_message
(
name
)
Back
|
FazBrowse Home
|
New Git URL