Swift: Make file checking in integration tests more strict

With Swift 6.1 the extractor will start to extract files outside of the test
directory. These files and their elements we do not want to see in our tests.
This commit is contained in:
Jeroen Ketema
2025-04-22 13:52:15 +02:00
parent 53bd2361af
commit a211998bc9
15 changed files with 31 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,5 +1,7 @@
import swift
from ClassDecl d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import swift
from Deinitializer d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import swift
from EnumDecl d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import codeql.swift.elements.decl.internal.AccessorOrNamedFunction
from AccessorOrNamedFunction f
where f.getLocation().getFile().getBaseName() != "Package.swift"
where
f.getLocation().getFile().getBaseName() != "Package.swift" and
exists(f.getLocation().getFile().getRelativePath())
select f

View File

@@ -1,5 +1,7 @@
import swift
from Initializer d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import swift
from ProtocolDecl d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import swift
from StructDecl d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,5 +1,7 @@
import swift
from VarDecl d
where d.getLocation().getFile().getBaseName() != "Package.swift"
where
d.getLocation().getFile().getBaseName() != "Package.swift" and
exists(d.getLocation().getFile().getRelativePath())
select d

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f

View File

@@ -1,4 +1,5 @@
import swift
from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f