FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/analysis/Efficiency.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
454
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
/
analysis
/
Efficiency.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (31 loc) · 1.18 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
analysis
/
Efficiency.ql
Copy path
File metadata and controls
34 lines (31 loc) · 1.18 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
/**
* Compute the efficiency of the points-to relation. That is the ratio of
* "interesting" facts to total facts.
*/
import
python
import
semmle.python.pointsto.PointsTo
import
semmle.python.pointsto.PointsToContext
predicate
trivial
(
ControlFlowNode
f
)
{
f
.
getNode
(
)
instanceof
Parameter
or
f
instanceof
NameConstantNode
or
f
.
getNode
(
)
instanceof
ImmutableLiteral
}
from
int
interesting_facts
,
int
interesting_facts_in_source
,
int
total_size
,
float
efficiency
where
interesting_facts
=
strictcount
(
ControlFlowNode
f
,
Object
value
,
ClassObject
cls
|
f
.
refersTo
(
value
,
cls
,
_
)
and
not
trivial
(
f
)
)
and
interesting_facts_in_source
=
strictcount
(
ControlFlowNode
f
,
Object
value
,
ClassObject
cls
|
f
.
refersTo
(
value
,
cls
,
_
)
and
not
trivial
(
f
)
and
exists
(
f
.
getScope
(
)
.
getEnclosingModule
(
)
.
getFile
(
)
.
getRelativePath
(
)
)
)
and
total_size
=
strictcount
(
ControlFlowNode
f
,
PointsToContext
ctx
,
Object
value
,
ClassObject
cls
,
ControlFlowNode
orig
|
PointsTo
::
points_to
(
f
,
ctx
,
value
,
cls
,
orig
)
)
and
efficiency
=
100.0
*
interesting_facts_in_source
/
total_size
select
interesting_facts
,
interesting_facts_in_source
,
total_size
,
efficiency
Back
|
FazBrowse Home
|
New Git URL