FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Imports/CyclicImport.ql at codeql-cli/v2.19.1 · 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
10.1k
Code
Issues
995
Pull requests
464
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
/
CyclicImport.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (24 loc) · 791 Bytes
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Imports
/
CyclicImport.ql
Copy path
File metadata and controls
26 lines (24 loc) · 791 Bytes
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
/**
* @name Cyclic import
* @description Module forms part of an import cycle, thereby indirectly importing itself.
* @kind problem
* @tags reliability
* maintainability
* modularity
* @problem.severity recommendation
* @sub-severity low
* @precision high
* @id py/cyclic-import
*/
import
python
import
Cyclic
from
ModuleValue
m1
,
ModuleValue
m2
,
Stmt
imp
where
imp
.
getEnclosingModule
(
)
=
m1
.
getScope
(
)
and
stmt_imports
(
imp
)
=
m2
and
circular_import
(
m1
,
m2
)
and
m1
!=
m2
and
// this query finds all cyclic imports that are *not* flagged by ModuleLevelCyclicImport
not
failing_import_due_to_cycle
(
m2
,
m1
,
_
,
_
,
_
,
_
)
and
not
exists
(
If
i
|
i
.
isNameEqMain
(
)
and
i
.
contains
(
imp
)
)
select
imp
,
"Import of module $@ begins an import cycle."
,
m2
,
m2
.
getName
(
)
Back
|
FazBrowse Home
|
New Git URL