Skip to content

Commit a211998

Browse files
committed
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.
1 parent 53bd236 commit a211998

File tree

15 files changed

+31
-8
lines changed

15 files changed

+31
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from ClassDecl d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from Deinitializer d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from EnumDecl d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import codeql.swift.elements.decl.internal.AccessorOrNamedFunction
22

33
from AccessorOrNamedFunction f
4-
where f.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
f.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(f.getLocation().getFile().getRelativePath())
57
select f
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from Initializer d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from ProtocolDecl d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from StructDecl d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import swift
22

33
from VarDecl d
4-
where d.getLocation().getFile().getBaseName() != "Package.swift"
4+
where
5+
d.getLocation().getFile().getBaseName() != "Package.swift" and
6+
exists(d.getLocation().getFile().getRelativePath())
57
select d
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import swift
22

33
from File f
4+
where exists(f.getRelativePath()) or f instanceof UnknownFile
45
select f

0 commit comments

Comments
 (0)