@@ -22,27 +22,31 @@ public final class Module {
22
22
let fileManager = FileManager . default
23
23
for path in paths {
24
24
let directory = URL ( fileURLWithPath: path)
25
- guard let directoryEnumerator = fileManager. enumerator ( at: directory, includingPropertiesForKeys: [ . isDirectoryKey] , options: [ . skipsHiddenFiles, . skipsPackageDescendants] ) else { continue }
25
+ guard let directoryEnumerator = fileManager. enumerator ( at: directory,
26
+ includingPropertiesForKeys: [ . isDirectoryKey] ,
27
+ options: [ . skipsHiddenFiles, . skipsPackageDescendants] )
28
+ else { continue }
29
+
30
+ let ignoredDirectories : Set < URL > = Set ( [
31
+ " node_modules " ,
32
+ " Packages " ,
33
+ " Pods " ,
34
+ " Resources " ,
35
+ " Tests "
36
+ ] . map { directory. appendingPathComponent ( $0) } )
37
+
26
38
for case let url as URL in directoryEnumerator {
27
- var isDirectory : ObjCBool = false
28
39
guard url. pathExtension == " swift " ,
29
- fileManager. isReadableFile ( atPath: url. path) ,
30
- fileManager. fileExists ( atPath: url. path, isDirectory: & isDirectory)
40
+ fileManager. isReadableFile ( atPath: url. path)
31
41
else {
32
- // Skip top-level Tests directory
33
- if isDirectory. boolValue == true ,
34
- url. lastPathComponent == " Tests " ,
35
- directory. appendingPathComponent ( " Tests " ) . path == url. path
36
- {
42
+ if ignoredDirectories. contains ( url) {
37
43
directoryEnumerator. skipDescendants ( )
38
44
}
39
45
40
46
continue
41
47
}
42
48
43
- if isDirectory. boolValue == false {
44
- sources. append ( ( url, directory) )
45
- }
49
+ sources. append ( ( url, directory) )
46
50
}
47
51
}
48
52
0 commit comments