Revert "Remove Python query tests for Architect"

This reverts commit 7c976848ef.
This commit is contained in:
Nick Rolfe
2019-06-04 12:25:38 +01:00
parent 7c976848ef
commit b5b7749867
9 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
| standard/python/attribute | Module a | Class B | Attribute |
| standard/python/attribute | Module b | Class C | Attribute |
| standard/python/import | Module a | Module b | Import |
| standard/python/import | Module b | Module c | Import |
| standard/python/import | Module c | Module b | Import |
| standard/python/inheritance | Class A | Class B | ClassExpr |
| standard/python/inheritance | Class A | Class C | ClassExpr |
| standard/python/inheritance | Class B | Class C | ClassExpr |
| standard/python/use | Module a | Class B | Attribute |
| standard/python/use | Module b | Class C | Attribute |

View File

@@ -0,0 +1,9 @@
import python
import Architect.Common.DependencyCategory
import Architect.Architect
from DependencyCategory dk, DependencyElement source, DependencyElement target, DependencyElement cause
where dk.isADependency(source, target, cause)
select dk.toString(), source.toString(), target.toString(), cause.toString()

View File

@@ -0,0 +1,4 @@
| standard/python/attribute |
| standard/python/import |
| standard/python/inheritance |
| standard/python/use |

View File

@@ -0,0 +1,13 @@
/**
* @name Categories
* @description Insert description here...
* @kind table
* @problem.severity warning
*/
import python
import Architect.Common.DependencyCategory
import Architect.Architect
from DependencyCategory dk
select dk

View File

@@ -0,0 +1,16 @@
| attribute | a.py | 3 | Attribute | class B |
| attribute | b.py | 3 | Attribute | class C |
| import | a.py | 1 | Import | Module b |
| import | b.py | 1 | Import | Module c |
| import | c.py | 1 | Import | Module b |
| inheritance | a.py | 3 | ClassExpr | builtin-class object |
| inheritance | a.py | 3 | ClassExpr | builtin-class type |
| inheritance | a.py | 3 | ClassExpr | class B |
| inheritance | a.py | 3 | ClassExpr | class C |
| inheritance | b.py | 3 | ClassExpr | builtin-class object |
| inheritance | b.py | 3 | ClassExpr | builtin-class type |
| inheritance | b.py | 3 | ClassExpr | class C |
| inheritance | c.py | 3 | ClassExpr | builtin-class object |
| inheritance | c.py | 3 | ClassExpr | builtin-class type |
| use | a.py | 3 | Attribute | class B |
| use | b.py | 3 | Attribute | class C |

View File

@@ -0,0 +1,8 @@
import python
import semmle.python.dependencies.Dependencies
from DependencyKind dk, AstNode src, Object target
where dk.isADependency(src, target)
select dk.toString(), src.getLocation().getFile().getShortName(), src.getLocation().getStartLine(), src.toString(), target.toString()

View File

@@ -0,0 +1,4 @@
import b
class A(b.B):
pass

View File

@@ -0,0 +1,4 @@
import c
class B(c.C):
pass

View File

@@ -0,0 +1,5 @@
import b
class C(object):
def foo(self):
b = B()