mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
Merge pull request #19344 from jketema/swift-files
Swift: Make file checking in tests more strict
This commit is contained in:
@@ -6,7 +6,8 @@ import codeql.swift.elements.expr.internal.DotSyntaxCallExpr
|
||||
|
||||
cached
|
||||
predicate toBeTested(Element e) {
|
||||
e instanceof File
|
||||
e instanceof File and
|
||||
(exists(e.(File).getRelativePath()) or e instanceof UnknownFile)
|
||||
or
|
||||
e instanceof ParameterizedProtocolType
|
||||
or
|
||||
|
||||
@@ -21,5 +21,5 @@ string describe(Decl d) {
|
||||
}
|
||||
|
||||
from Decl d
|
||||
where d.getLocation().getFile().getName() != ""
|
||||
where exists(d.getLocation().getFile().getRelativePath())
|
||||
select d, strictconcat(describe(d), ", ")
|
||||
|
||||
@@ -27,6 +27,6 @@ string describe(Function f) {
|
||||
|
||||
from Function f
|
||||
where
|
||||
not f.getFile() instanceof UnknownFile and
|
||||
exists(f.getFile().getRelativePath()) and
|
||||
not f.getName().matches("%init%")
|
||||
select f, concat(describe(f), ", ")
|
||||
|
||||
@@ -16,7 +16,7 @@ string describe(Type t) {
|
||||
|
||||
from VarDecl v, Type t
|
||||
where
|
||||
v.getLocation().getFile().getBaseName() != "" and
|
||||
exists(v.getLocation().getFile().getRelativePath()) and
|
||||
not v.getName() = "self" and
|
||||
t = v.getType()
|
||||
select v, t.toString(), concat(describe(t), ", ")
|
||||
|
||||
@@ -14,7 +14,7 @@ string describe(TypeDecl td) {
|
||||
|
||||
from VarDecl v, TypeDecl td
|
||||
where
|
||||
v.getLocation().getFile().getBaseName() != "" and
|
||||
exists(v.getLocation().getFile().getRelativePath()) and
|
||||
not v.getName() = "self" and
|
||||
(
|
||||
td = v.getType().(NominalType).getDeclaration() or
|
||||
|
||||
@@ -14,6 +14,6 @@ string describe(Type t) {
|
||||
|
||||
from VarDecl v, Type t
|
||||
where
|
||||
v.getLocation().getFile().getBaseName() != "" and
|
||||
exists(v.getLocation().getFile().getRelativePath()) and
|
||||
t = v.getType()
|
||||
select v, t.toString(), concat(describe(t), ", ")
|
||||
|
||||
@@ -22,6 +22,6 @@ string describe(Type t) {
|
||||
|
||||
from VarDecl v, Type t
|
||||
where
|
||||
v.getLocation().getFile().getBaseName() != "" and
|
||||
exists(v.getLocation().getFile().getRelativePath()) and
|
||||
t = v.getType()
|
||||
select v, t.toString(), strictconcat(describe(t), ", ")
|
||||
|
||||
@@ -3,4 +3,5 @@ import swift
|
||||
string describe(File f) { (f.isSuccessfullyExtracted() and result = "isSuccessfullyExtracted") }
|
||||
|
||||
from File f
|
||||
where exists(f.getRelativePath()) or f instanceof UnknownFile
|
||||
select f, concat(f.getRelativePath(), ", "), concat(describe(f), ", ")
|
||||
|
||||
Reference in New Issue
Block a user